mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Detail view UI test: test action filter after refresh
This commit is contained in:
parent
551020609d
commit
703523fd64
@ -624,7 +624,8 @@
|
|||||||
testListView: [{
|
testListView: [{
|
||||||
fieldA: 'fieldA-1',
|
fieldA: 'fieldA-1',
|
||||||
fieldB: 'fieldB-1',
|
fieldB: 'fieldB-1',
|
||||||
fieldC: 'fieldC-1'
|
fieldC: 'fieldC-1',
|
||||||
|
state: 'on'
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@ -649,7 +650,8 @@
|
|||||||
args.complete({
|
args.complete({
|
||||||
data: {
|
data: {
|
||||||
fieldA: 'fieldA-2',
|
fieldA: 'fieldA-2',
|
||||||
fieldB: 'fieldB-2'
|
fieldB: 'fieldB-2',
|
||||||
|
state: 'off'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -660,9 +662,19 @@
|
|||||||
equal($detailView.find('tr.fieldA .value').html(), 'fieldA-2', 'Correct table value for fieldA');
|
equal($detailView.find('tr.fieldA .value').html(), 'fieldA-2', 'Correct table value for fieldA');
|
||||||
equal($detailView.find('tr.fieldB .value').html(), 'fieldB-2', 'Correct table value for fieldB');
|
equal($detailView.find('tr.fieldB .value').html(), 'fieldB-2', 'Correct table value for fieldB');
|
||||||
equal($detailView.find('tr.fieldC .value').html(), 'fieldC-1', 'Correct table value for fieldC');
|
equal($detailView.find('tr.fieldC .value').html(), 'fieldC-1', 'Correct table value for fieldC');
|
||||||
|
|
||||||
|
equal($detailView.find('.action').size(), 1, 'Correct action count');
|
||||||
|
equal($detailView.find('.action.updateDataTestAsync').size(), 1, 'updateDataTestAsync present');
|
||||||
|
equal($detailView.find('.action.filteredAction').size(), 0, 'filteredAction not present');
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
filteredAction: {
|
||||||
|
label: 'filteredAction',
|
||||||
|
action: function() {},
|
||||||
|
messages: { notification: function() { return 'notification'; } }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
@ -675,7 +687,14 @@
|
|||||||
}],
|
}],
|
||||||
dataProvider: function(args) {
|
dataProvider: function(args) {
|
||||||
args.response.success({
|
args.response.success({
|
||||||
data: args.context.testListView[0]
|
data: args.context.testListView[0],
|
||||||
|
actionFilter: function(args) {
|
||||||
|
if (args.context.testListView[0].state == 'on') {
|
||||||
|
return ['updateDataTestAsync', 'filteredAction'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['updateDataTestAsync'];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -690,7 +709,6 @@
|
|||||||
}
|
}
|
||||||
}).appendTo('#qunit-fixture');
|
}).appendTo('#qunit-fixture');
|
||||||
|
|
||||||
stop();
|
|
||||||
$.fn.dataTable = function() { return this; };
|
$.fn.dataTable = function() { return this; };
|
||||||
$.fn.listView = function(args1, args2) {
|
$.fn.listView = function(args1, args2) {
|
||||||
if (args1 == 'replaceItem')
|
if (args1 == 'replaceItem')
|
||||||
@ -707,6 +725,12 @@
|
|||||||
};
|
};
|
||||||
$detailView.data('list-view-row', $listViewRow);
|
$detailView.data('list-view-row', $listViewRow);
|
||||||
$detailView.detailView(detailView);
|
$detailView.detailView(detailView);
|
||||||
|
|
||||||
|
equal($detailView.find('.action').size(), 2, 'Correct action count');
|
||||||
|
equal($detailView.find('.action.updateDataTestAsync').size(), 1, 'updateDataTestAsync present');
|
||||||
|
equal($detailView.find('.action.filteredAction').size(), 1, 'filteredAction present');
|
||||||
|
|
||||||
|
stop();
|
||||||
$detailView.find('.action.updateDataTestAsync a').click();
|
$detailView.find('.action.updateDataTestAsync a').click();
|
||||||
$detailView.data('view-args').actions.updateDataTestAsync.preAction = function(args) {
|
$detailView.data('view-args').actions.updateDataTestAsync.preAction = function(args) {
|
||||||
start();
|
start();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user