mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
Add detail view action filter tests
This commit is contained in:
parent
17d179535b
commit
44f7fd4f97
@ -269,6 +269,48 @@
|
||||
$detailView.find('.detail-actions .action.actionB a').click(); // <a> triggers action, not action's container
|
||||
});
|
||||
|
||||
test('Action filter', function() {
|
||||
var detailView = {
|
||||
actions: {
|
||||
actionA: {
|
||||
label: 'testActionA',
|
||||
action: function(args) {}
|
||||
},
|
||||
actionB: {
|
||||
label: 'testActionB',
|
||||
action: function(args) {}
|
||||
}
|
||||
},
|
||||
tabs: {
|
||||
tabA: {
|
||||
title: 'tabA',
|
||||
fields: {
|
||||
fieldA: { label: 'fieldA' },
|
||||
fieldB: { label: 'fieldB' }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
args.response.success({
|
||||
actionFilter: function() {
|
||||
return ['actionA'];
|
||||
},
|
||||
data: {
|
||||
fieldA: 'fieldAContent',
|
||||
fieldB: 'fieldBContent'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var $detailView = $('<div>');
|
||||
|
||||
$detailView.detailView(detailView).appendTo('#qunit-fixture');
|
||||
|
||||
equal($detailView.find('.detail-actions .action').size(), 1, 'Correct action count');
|
||||
equal($detailView.find('.detail-actions .action.actionA').size(), 1, 'actionA present');
|
||||
notEqual($detailView.find('.detail-actions .action.actionB').size(), 1, 'actionB not present');
|
||||
});
|
||||
|
||||
test('Refresh', function() {
|
||||
var dataA = ['dataLoad1A', 'dataLoad2A'];
|
||||
var dataB = ['dataLoad1B', 'dataLoad2B'];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user