This repository has been archived by the owner on Dec 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 675
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
Bruno Basto
authored and
Jonathan Mak
committed
Apr 30, 2014
1 parent
da311a8
commit bbaa37f
Showing
2 changed files
with
77 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,86 @@ | ||
YUI.add('module-tests', function(Y) { | ||
|
||
var YgetClassName = Y.getClassName; | ||
|
||
var CSS_CELLEDITOR_EDIT_INPUT_NAME = YgetClassName('celleditor', 'edit', 'input', 'name'); | ||
|
||
var CSS_CELLEDITOR_EDIT_INPUT_VALUE = YgetClassName('celleditor', 'edit', 'input', 'value'); | ||
|
||
var suite = new Y.Test.Suite('aui-datatable'); | ||
|
||
var data = [ | ||
{ fruit: ['apple'] }, | ||
{ fruit: ['cherry'] }, | ||
{ fruit: ['cherry'] }, | ||
{ fruit: ['apple','cherry'] } | ||
]; | ||
|
||
var datatable = null, dropdownEditor = null; | ||
|
||
suite.add(new Y.Test.Case({ | ||
name: 'Automated Tests', | ||
'test is empty': function() { | ||
Y.Assert.pass('No Tests Provided For This Module'); | ||
name: 'Datatable', | ||
'Initialize DropDownCellEditor': function() { | ||
dropdownEditor = new Y.DropDownCellEditor({ | ||
editable: true, | ||
multiple: true, | ||
options: { | ||
apple: 'Apple', | ||
cherry: 'Cherry', | ||
banana: 'Banana', | ||
kiwi: 'Kiwi' | ||
} | ||
}); | ||
}, | ||
|
||
'Initialize Datatable': function() { | ||
datatable = new Y.DataTable({ | ||
boudingBox: '#datatable', | ||
columns: [ | ||
{ | ||
editor: dropdownEditor, | ||
key: 'fruit', | ||
sortable: true | ||
} | ||
], | ||
data: data, | ||
plugins: [ | ||
{ | ||
fn: Y.Plugin.DataTableHighlight | ||
} | ||
] | ||
}); | ||
|
||
Y.Assert.isNotNull(datatable); | ||
}, | ||
|
||
'Render Datatable': function() { | ||
datatable = datatable.render(); | ||
|
||
Y.Assert.isNotNull(datatable); | ||
}, | ||
|
||
'AUI-1194 Allow empty values in BaseCellEditor': function() { | ||
datatable.set('activeCoord', [0, 0]); | ||
|
||
datatable._onEditCell({}); | ||
|
||
dropdownEditor.fire('initEdit'); | ||
dropdownEditor.fire('edit'); | ||
|
||
dropdownEditor.editContainer.one('.' + CSS_CELLEDITOR_EDIT_INPUT_NAME).val(''); | ||
dropdownEditor.editContainer.one('.' + CSS_CELLEDITOR_EDIT_INPUT_VALUE).val(''); | ||
|
||
dropdownEditor.saveOptions(); | ||
|
||
var options = dropdownEditor.get('options'); | ||
|
||
Y.Assert.isTrue(options.hasOwnProperty('')); | ||
Y.Assert.isNotUndefined(options['']); | ||
} | ||
})); | ||
|
||
Y.Test.Runner.add(suite); | ||
|
||
}, '', { | ||
requires: ['test'] | ||
requires: ['aui-datatable', 'test'] | ||
}); |