Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
amk221 committed Jun 6, 2024
1 parent ee8d39c commit 09edb69
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/integration/modifiers/auto-focus-test.gjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'dummy/tests/helpers';
import { render, rerender } from '@ember/test-helpers';
import { render, find, rerender } from '@ember/test-helpers';
import autoFocus from '@zestia/ember-auto-focus/modifiers/auto-focus';
import { tracked } from '@glimmer/tracking';
import { on } from '@ember/modifier';
Expand Down Expand Up @@ -147,4 +147,28 @@ module('autoFocus', function (hooks) {
'property removed after focus'
);
});

test('other options', async function (assert) {
assert.expect(1);

await render(<template>
{{! template-lint-disable no-forbidden-elements}}
{{! prettier-ignore }}
<style>
.parent {
height: 100px;
overflow-y: scroll;
}
input {
margin-top: 100px
}
</style>
<div class="parent">
<button type="button" {{autoFocus preventScroll=true}} />
</div>
</template>);

assert.strictEqual(find('.parent').scrollTop, 0);
});
});

0 comments on commit 09edb69

Please sign in to comment.