Skip to content

Commit 5d58268

Browse files
committed
Add test for transitionDuration when only one item is present which will be moved
1 parent a076250 commit 5d58268

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { module, test } from 'qunit';
2+
import { setupRenderingTest } from 'ember-qunit';
3+
import { find, render } from '@ember/test-helpers';
4+
import { set } from '@ember/object';
5+
import { drag } from 'ember-sortable/test-support';
6+
import hbs from 'htmlbars-inline-precompile';
7+
8+
module('Integration | Modifier | sortable-item', function (hooks) {
9+
setupRenderingTest(hooks);
10+
11+
test('Drag works with one item', async function (assert) {
12+
this.items = ['Uno'];
13+
14+
this.update = (items) => {
15+
set(this, 'items', items);
16+
};
17+
18+
await render(hbs`
19+
<ol id="test-list" {{sortable-group onChange=this.update}}>
20+
{{#each this.items as |item|}}
21+
<li data-test-item {{sortable-item model=item}}>{{item}}</li>
22+
{{/each}}
23+
</ol>
24+
`);
25+
26+
await drag('mouse', '[data-test-item]', () => {
27+
return { dy: 10 };
28+
});
29+
30+
assert.equal(contents('#test-list'), 'Uno');
31+
});
32+
33+
function contents(selector) {
34+
return find(selector).textContent.replace(//g, '').replace(/\s+/g, ' ').replace(/^\s+/, '').replace(/\s+$/, '');
35+
}
36+
});

0 commit comments

Comments
 (0)