|
624 | 624 | testListView: [{ |
625 | 625 | fieldA: 'fieldA-1', |
626 | 626 | fieldB: 'fieldB-1', |
627 | | - fieldC: 'fieldC-1' |
| 627 | + fieldC: 'fieldC-1', |
| 628 | + state: 'on' |
628 | 629 | }] |
629 | 630 | }, |
630 | 631 | actions: { |
|
649 | 650 | args.complete({ |
650 | 651 | data: { |
651 | 652 | fieldA: 'fieldA-2', |
652 | | - fieldB: 'fieldB-2' |
| 653 | + fieldB: 'fieldB-2', |
| 654 | + state: 'off' |
653 | 655 | } |
654 | 656 | }); |
655 | 657 |
|
|
660 | 662 | equal($detailView.find('tr.fieldA .value').html(), 'fieldA-2', 'Correct table value for fieldA'); |
661 | 663 | equal($detailView.find('tr.fieldB .value').html(), 'fieldB-2', 'Correct table value for fieldB'); |
662 | 664 | equal($detailView.find('tr.fieldC .value').html(), 'fieldC-1', 'Correct table value for fieldC'); |
| 665 | + |
| 666 | + equal($detailView.find('.action').size(), 1, 'Correct action count'); |
| 667 | + equal($detailView.find('.action.updateDataTestAsync').size(), 1, 'updateDataTestAsync present'); |
| 668 | + equal($detailView.find('.action.filteredAction').size(), 0, 'filteredAction not present'); |
663 | 669 | stop(); |
664 | 670 | } |
665 | 671 | } |
| 672 | + }, |
| 673 | + |
| 674 | + filteredAction: { |
| 675 | + label: 'filteredAction', |
| 676 | + action: function() {}, |
| 677 | + messages: { notification: function() { return 'notification'; } } |
666 | 678 | } |
667 | 679 | }, |
668 | 680 | tabs: { |
|
675 | 687 | }], |
676 | 688 | dataProvider: function(args) { |
677 | 689 | args.response.success({ |
678 | | - data: args.context.testListView[0] |
| 690 | + data: args.context.testListView[0], |
| 691 | + actionFilter: function(args) { |
| 692 | + if (args.context.testListView[0].state == 'on') { |
| 693 | + return ['updateDataTestAsync', 'filteredAction']; |
| 694 | + } |
| 695 | + |
| 696 | + return ['updateDataTestAsync']; |
| 697 | + } |
679 | 698 | }); |
680 | 699 | } |
681 | 700 | } |
|
690 | 709 | } |
691 | 710 | }).appendTo('#qunit-fixture'); |
692 | 711 |
|
693 | | - stop(); |
694 | 712 | $.fn.dataTable = function() { return this; }; |
695 | 713 | $.fn.listView = function(args1, args2) { |
696 | 714 | if (args1 == 'replaceItem') |
|
707 | 725 | }; |
708 | 726 | $detailView.data('list-view-row', $listViewRow); |
709 | 727 | $detailView.detailView(detailView); |
| 728 | + |
| 729 | + equal($detailView.find('.action').size(), 2, 'Correct action count'); |
| 730 | + equal($detailView.find('.action.updateDataTestAsync').size(), 1, 'updateDataTestAsync present'); |
| 731 | + equal($detailView.find('.action.filteredAction').size(), 1, 'filteredAction present'); |
| 732 | + |
| 733 | + stop(); |
710 | 734 | $detailView.find('.action.updateDataTestAsync a').click(); |
711 | 735 | $detailView.data('view-args').actions.updateDataTestAsync.preAction = function(args) { |
712 | 736 | start(); |
|
0 commit comments