-
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.
CHG: Remove DataProvider.getInstance() which is buggy
- Loading branch information
1 parent
651e4c0
commit 1e16db1
Showing
14 changed files
with
164 additions
and
58 deletions.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "simple_select", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"homepage": "https://github.com/mycolorway/simple-select", | ||
"authors": [ | ||
"farthinker <[email protected]>" | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,62 @@ | ||
DataProvider = require '../src/models/data-provider' | ||
HtmlSelect = require '../src/html-select' | ||
expect = chai.expect | ||
|
||
describe 'Html Select', -> | ||
|
||
dataProvider = null | ||
htmlSelect = null | ||
|
||
beforeEach -> | ||
dataProvider = new DataProvider | ||
groups: { | ||
'Cat Animals': [ | ||
['Cat', '1'] | ||
['Tiger', '2'] | ||
], | ||
'Dog Animals': [ | ||
['Dog', '3'] | ||
['Wolf', '4'] | ||
] | ||
} | ||
|
||
htmlSelect = new HtmlSelect | ||
el: $ '<select>' | ||
groups: dataProvider.getGroups() | ||
|
||
afterEach -> | ||
dataProvider = null | ||
htmlSelect = null | ||
|
||
it 'accepts element and groups as options', -> | ||
expect(htmlSelect.el.is('select')).to.be.true | ||
expect(htmlSelect.groups.length).to.be.equal 2 | ||
|
||
it 'will render after setGroups', -> | ||
expect(htmlSelect.el.find('optgroup').length).to.be.equal 2 | ||
expect(htmlSelect.el.find('option').length).to.be.equal 4 | ||
|
||
htmlSelect.setGroups [] | ||
expect(htmlSelect.el.html()).to.be.equal '<option></option>' | ||
|
||
it 'can get blank option element', -> | ||
$option = htmlSelect.getBlankOption() | ||
expect($option).to.be.false | ||
|
||
htmlSelect.setGroups [] | ||
$option = htmlSelect.getBlankOption() | ||
expect($option).to.be.not.false | ||
expect($option.is('option')).to.be.true | ||
|
||
it 'can get/set value', -> | ||
htmlSelect.setValue '1' | ||
expect(htmlSelect.getValue()).to.be.equal '1' | ||
|
||
htmlSelect.setValue ['2'] | ||
expect(htmlSelect.getValue()).to.be.equal '2' | ||
|
||
htmlSelect.el.attr 'multiple', '' | ||
htmlSelect.setValue '3' | ||
expect(JSON.stringify htmlSelect.getValue()).to.be.equal '["3"]' | ||
htmlSelect.setValue ['3', '4'] | ||
expect(JSON.stringify htmlSelect.getValue()).to.be.equal '["3","4"]' |
Oops, something went wrong.