Skip to content

Commit 490791e

Browse files
Update tests/integration/components/gleam-logo-test.js
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 8052924 commit 490791e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/integration/components/gleam-logo-test.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,13 @@ module('Integration | Component | gleam-logo', function (hooks) {
105105

106106
test('it handles hover state correctly', async function (assert) {
107107
await render(hbs`<GleamLogo />`);
108-
109-
// Wait for the component to fully initialize
110-
await new Promise((resolve) => setTimeout(resolve, 0));
108+
await settled();
111109

112110
const container = this.element.querySelector('div');
113111
assert.ok(container, 'Container exists');
114112

115-
// Create and attach mock Rive instance
116-
const mockRive = new MockRive({ canvas: container.querySelector('canvas') });
117-
container.__riveInstance = mockRive;
113+
// Get the rive instance from the container
114+
const mockRive = container.__riveInstance;
118115
assert.ok(mockRive, 'Rive instance exists');
119116

120117
// Simulate Rive load event
@@ -130,8 +127,17 @@ module('Integration | Component | gleam-logo', function (hooks) {
130127
// Verify initial hover state
131128
assert.false(hoverInput.value, 'Hover input is initially false');
132129

133-
// Wait for hover out timeout
134-
await new Promise((resolve) => setTimeout(resolve, 1000));
130+
// Trigger mouseenter event to test hover behavior
131+
container.dispatchEvent(new MouseEvent('mouseenter'));
132+
await settled();
133+
134+
// Verify hover state after mouseenter
135+
assert.true(hoverInput.value, 'Hover input is set to true after mouseenter');
136+
137+
// Trigger mouseleave event
138+
container.dispatchEvent(new MouseEvent('mouseleave'));
139+
await settled();
140+
135141
assert.false(hoverInput.value, 'Hover input is set to false after timeout');
136142
});
137143
});

0 commit comments

Comments
 (0)