Skip to content

Instantly share code, notes, and snippets.

@joelwatson
Last active July 6, 2017 14:52
Show Gist options
  • Save joelwatson/aa8e7a19dea4d489cfd8e250c3c2b5c7 to your computer and use it in GitHub Desktop.
Save joelwatson/aa8e7a19dea4d489cfd8e250c3c2b5c7 to your computer and use it in GitHub Desktop.
Asserting displayValue of ComboBox
Ext.define('Sandbox.view.test.combobox.Base', {
extend: 'Ext.form.field.ComboBox',
id: 'futureCmp',
displayField: 'text',
valueField: 'id',
store: {
fields: ['id', 'text'],
data: [
[1, 'Apples'],
[2, 'Oranges']
]
}
});
var PO = {
combo: function () {
return ST.comboBox('@futureCmp');
},
displayValue: function (value) {
return this.combo()
.execute(function (cmp) {
var record = cmp.findRecordByDisplay(value);
return record ? record.get('id') : false;
}).and(function () {
var future = this.future,
id = future.data.executeResult;
future.setValue(id);
// assert that the value has been correctly selected
future.value(id);
});
}
}
it('should select correct value from displayField', function () {
// We have a single method on our page object that encapsulates some complex logic
PO.displayValue('Oranges');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment