0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

fix gh-selectize-test

This commit is contained in:
Kevin Ansfield 2017-01-31 21:15:17 +00:00 committed by Austin Burdine
parent 11a06e7d19
commit 7e14378a63

View file

@ -15,19 +15,24 @@ describe('Unit: Component: gh-selectize', function () {
it('re-orders selection when selectize order is changed', function () { it('re-orders selection when selectize order is changed', function () {
let component = this.subject(); let component = this.subject();
let item1 = {id: '1', name: 'item 1'};
let item2 = {id: '2', name: 'item 2'};
let item3 = {id: '3', name: 'item 3'};
run(() => { run(() => {
component.set('content', emberA(['item 1', 'item 2', 'item 3'])); component.set('content', emberA([item1, item2, item3]));
component.set('selection', emberA(['item 2', 'item 3'])); component.set('selection', emberA([item2, item3]));
component.set('multiple', true); component.set('multiple', true);
component.set('optionValuePath', 'content.id');
component.set('optionLabelPath', 'content.name');
}); });
this.render(); this.render();
run(() => { run(() => {
component._selectize.setValue(['item 3', 'item 2']); component._selectize.setValue(['3', '2']);
}); });
expect(component.get('value').toArray(), 'component value').to.deep.equal(['item 3', 'item 2']); expect(component.get('selection').toArray(), 'component selection').to.deep.equal([item3, item2]);
expect(component.get('selection').toArray(), 'component selection').to.deep.equal(['item 3', 'item 2']);
}); });
}); });