Fixed column_select with integer values.
This commit is contained in:
parent
065605fe3c
commit
6f56399af2
2 changed files with 11 additions and 3 deletions
|
@ -37,7 +37,7 @@ class App.ColumnSelect extends Spine.Controller
|
||||||
@values = []
|
@values = []
|
||||||
_.each @options.attribute.options, (option) =>
|
_.each @options.attribute.options, (option) =>
|
||||||
if option.selected
|
if option.selected
|
||||||
@values.push option.value
|
@values.push option.value.toString()
|
||||||
|
|
||||||
@html App.view('generic/column_select')
|
@html App.view('generic/column_select')
|
||||||
attribute: @options.attribute
|
attribute: @options.attribute
|
||||||
|
|
|
@ -5,11 +5,14 @@ test( "column_select check", function(assert) {
|
||||||
var el = $('#form1')
|
var el = $('#form1')
|
||||||
var defaults = {
|
var defaults = {
|
||||||
column_select2: ['aaa', 'bbb'],
|
column_select2: ['aaa', 'bbb'],
|
||||||
|
column_select3: [1, '2'],
|
||||||
}
|
}
|
||||||
var options = {
|
var options = {
|
||||||
'aaa': 'aaa display',
|
'aaa': 'aaa display',
|
||||||
'bbb': 'bbb display',
|
'bbb': 'bbb display',
|
||||||
'ccc': 'ccc display',
|
'ccc': 'ccc display',
|
||||||
|
1: '1 display',
|
||||||
|
'2': '2 display',
|
||||||
}
|
}
|
||||||
new App.ControllerForm({
|
new App.ControllerForm({
|
||||||
el: el,
|
el: el,
|
||||||
|
@ -17,6 +20,7 @@ test( "column_select check", function(assert) {
|
||||||
configure_attributes: [
|
configure_attributes: [
|
||||||
{ name: 'column_select1', display: 'ColumnSelect1', tag: 'column_select', options: options, null: true, default: defaults['column_select1'] },
|
{ name: 'column_select1', display: 'ColumnSelect1', tag: 'column_select', options: options, null: true, default: defaults['column_select1'] },
|
||||||
{ name: 'column_select2', display: 'ColumnSelect2', tag: 'column_select', options: options, null: false, default: defaults['column_select2'] },
|
{ name: 'column_select2', display: 'ColumnSelect2', tag: 'column_select', options: options, null: false, default: defaults['column_select2'] },
|
||||||
|
{ name: 'column_select3', display: 'ColumnSelect3', tag: 'column_select', options: options, null: false, default: defaults['column_select3'] },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
autofocus: true
|
autofocus: true
|
||||||
|
@ -25,6 +29,7 @@ test( "column_select check", function(assert) {
|
||||||
var params = App.ControllerForm.params(el)
|
var params = App.ControllerForm.params(el)
|
||||||
var test_params = {
|
var test_params = {
|
||||||
column_select2: ['aaa', 'bbb'],
|
column_select2: ['aaa', 'bbb'],
|
||||||
|
column_select3: ['1', '2'],
|
||||||
}
|
}
|
||||||
deepEqual(params, test_params, 'form param check')
|
deepEqual(params, test_params, 'form param check')
|
||||||
|
|
||||||
|
@ -35,19 +40,22 @@ test( "column_select check", function(assert) {
|
||||||
test_params = {
|
test_params = {
|
||||||
column_select1: 'bbb',
|
column_select1: 'bbb',
|
||||||
column_select2: ['aaa', 'bbb'],
|
column_select2: ['aaa', 'bbb'],
|
||||||
|
column_select3: ['1', '2'],
|
||||||
}
|
}
|
||||||
deepEqual(params, test_params, 'form param check')
|
deepEqual(params, test_params, 'form param check')
|
||||||
|
|
||||||
var done = assert.async();
|
var done = assert.async();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('[data-name="column_select1"] .js-pool .js-option[data-value="aaa"]').click()
|
$('[data-name="column_select1"] .js-pool .js-option[data-value="aaa"]').click()
|
||||||
$('[data-name="column_select2"] .js-pool .js-option[data-value="ccc"]').click()
|
$('[data-name="column_select2"] .js-pool .js-option[data-value="1"]').click()
|
||||||
$('[data-name="column_select2"].js-selected .js-option[data-value="aaa"]').click()
|
$('[data-name="column_select2"].js-selected .js-option[data-value="aaa"]').click()
|
||||||
|
$('[data-name="column_select3"] .js-pool .js-option[data-value="aaa"]').click()
|
||||||
|
|
||||||
params = App.ControllerForm.params(el)
|
params = App.ControllerForm.params(el)
|
||||||
test_params = {
|
test_params = {
|
||||||
column_select1: ['aaa', 'bbb'],
|
column_select1: ['aaa', 'bbb'],
|
||||||
column_select2: ['bbb', 'ccc'],
|
column_select2: ['1', 'bbb'],
|
||||||
|
column_select3: ['1', '2', 'aaa'],
|
||||||
}
|
}
|
||||||
deepEqual(params, test_params, 'form param check')
|
deepEqual(params, test_params, 'form param check')
|
||||||
done();
|
done();
|
||||||
|
|
Loading…
Reference in a new issue