-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
89 additions
and
23 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"name": "jquery.ajax-combobox", | ||
"description": "jQuery plugin to create a text box which can auto-complete and pull-down-select.", | ||
"license": "MIT", | ||
"version": "7.5.2", | ||
"version": "7.5.3", | ||
"author": "Yuusaku Miyazaki <[email protected]>", | ||
"homepage": "https://github.com/sutara79/jquery.ajax-combobox", | ||
"main": "dist/jquery.ajax-combobox.min.js", | ||
|
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,60 @@ | ||
/** | ||
* @file Unit Testing | ||
*/ | ||
describe('$.ajaxComboBox._setOrderbyOption', () => { | ||
it('should convert strings to array', () => { | ||
const orders = 'field1 ASC'; | ||
const field = 'field999'; | ||
const result = $.ajaxComboBox.prototype._setOrderbyOption(orders, field); | ||
assert.equal(result[0][0], 'field1'); | ||
assert.equal(result[0][1], 'ASC'); | ||
}); | ||
|
||
it('should accept multiple space', () => { | ||
const orders = 'field1 DESC'; | ||
const field = 'field999'; | ||
const result = $.ajaxComboBox.prototype._setOrderbyOption(orders, field); | ||
assert.equal(result[0][0], 'field1'); | ||
assert.equal(result[0][1], 'DESC'); | ||
}); | ||
|
||
it('should complement a field name', () => { | ||
const orders = 'ASC'; | ||
const field = 'field999'; | ||
const result = $.ajaxComboBox.prototype._setOrderbyOption(orders, field); | ||
assert.equal(result[0][0], 'field999'); | ||
assert.equal(result[0][1], 'ASC'); | ||
}); | ||
|
||
it('should accept lowercase "asc" or "desc"', () => { | ||
// In the future, lowercase "asc" or "desc" are judged to be field names. | ||
|
||
const orders = 'desc'; | ||
const field = 'field999'; | ||
const result = $.ajaxComboBox.prototype._setOrderbyOption(orders, field); | ||
assert.equal(result[0][0], 'field999'); | ||
assert.equal(result[0][1], 'desc'); | ||
}); | ||
|
||
it('should accept an array', () => { | ||
const orders = [ | ||
'field1', | ||
'field2 DESC', | ||
'field3 ASC', | ||
'DESC' | ||
]; | ||
const field = 'field999'; | ||
const result = $.ajaxComboBox.prototype._setOrderbyOption(orders, field); | ||
assert.equal(result[0][0], 'field1'); | ||
assert.equal(result[0][1], 'ASC'); | ||
|
||
assert.equal(result[1][0], 'field2'); | ||
assert.equal(result[1][1], 'DESC'); | ||
|
||
assert.equal(result[2][0], 'field3'); | ||
assert.equal(result[2][1], 'ASC'); | ||
|
||
assert.equal(result[3][0], 'field999'); | ||
assert.equal(result[3][1], 'DESC'); | ||
}); | ||
}); |