forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drag-n-drop re-ordering of tags in post settings menu
refs TryGhost#5976 - adds `onChange` handler to `gh-selectize` component to update the `selection` property when selectize's value is changed (eg, by the drag_drop plugin updating the order) - adds the `drag_drop` plugin to the list of selectize plugins used by the tags input on the post settings menu
- Loading branch information
1 parent
0035cc2
commit 716032f
Showing
3 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* jshint expr:true */ | ||
import { expect } from 'chai'; | ||
import { | ||
describeComponent, | ||
it | ||
} from 'ember-mocha'; | ||
import Ember from 'ember'; | ||
|
||
const {run} = Ember; | ||
|
||
describeComponent( | ||
'gh-selectize', | ||
'Unit: Component: gh-selectize', | ||
{ | ||
// Specify the other units that are required for this test | ||
// needs: ['component:foo', 'helper:bar'], | ||
unit: true | ||
}, | ||
function () { | ||
it('re-orders selection when selectize order is changed', function () { | ||
const component = this.subject(); | ||
|
||
run(() => { | ||
component.set('content', Ember.A(['item 1', 'item 2', 'item 3'])); | ||
component.set('selection', Ember.A(['item 2', 'item 3'])); | ||
component.set('multiple', true); | ||
}); | ||
|
||
this.render(); | ||
|
||
run(() => { | ||
component._selectize.setValue(['item 3', 'item 2']); | ||
}); | ||
|
||
expect(component.get('value'), 'component value').to.deep.equal(['item 3', 'item 2']); | ||
expect(component.get('selection'), 'component selection').to.deep.equal(['item 3', 'item 2']); | ||
}); | ||
} | ||
); |