|
630 | 630 | actions: { |
631 | 631 | updateDataTestAsync: { |
632 | 632 | label: 'updateDataTestAsync', |
633 | | - preAction: function(args) { return true; }, |
| 633 | + preAction: function(args) { |
| 634 | + start(); |
| 635 | + ok(true, 'Pre-action called'); |
| 636 | + equal($detailView.data('view-args').context.testListView[0].fieldA, 'fieldA-1', 'Pre-action: Correct context value for fieldA'); |
| 637 | + equal($detailView.data('view-args').context.testListView[0].fieldB, 'fieldB-1', 'Pre-action: Correct context value for fieldB'); |
| 638 | + equal($detailView.data('view-args').context.testListView[0].fieldC, 'fieldC-1', 'Pre-action: Correct context value for fieldC'); |
| 639 | + stop(); |
| 640 | + |
| 641 | + return true; |
| 642 | + }, |
634 | 643 | action: function(args) { |
635 | 644 | args.response.success(); |
636 | 645 | }, |
|
651 | 660 | equal($detailView.find('tr.fieldA .value').html(), 'fieldA-2', 'Correct table value for fieldA'); |
652 | 661 | equal($detailView.find('tr.fieldB .value').html(), 'fieldB-2', 'Correct table value for fieldB'); |
653 | 662 | equal($detailView.find('tr.fieldC .value').html(), 'fieldC-1', 'Correct table value for fieldC'); |
| 663 | + stop(); |
654 | 664 | } |
655 | 665 | } |
656 | 666 | } |
|
698 | 708 | $detailView.data('list-view-row', $listViewRow); |
699 | 709 | $detailView.detailView(detailView); |
700 | 710 | $detailView.find('.action.updateDataTestAsync a').click(); |
| 711 | + $detailView.data('view-args').actions.updateDataTestAsync.preAction = function(args) { |
| 712 | + start(); |
| 713 | + equal($detailView.data('view-args').context.testListView[0].fieldA, 'fieldA-2', 'Pre-action: Correct context value for fieldA'); |
| 714 | + equal($detailView.data('view-args').context.testListView[0].fieldB, 'fieldB-2', 'Pre-action: Correct context value for fieldB'); |
| 715 | + equal($detailView.data('view-args').context.testListView[0].fieldC, 'fieldC-1', 'Pre-action: Correct context value for fieldC'); |
| 716 | + ok(true, 'Pre-action called'); |
| 717 | + |
| 718 | + return false; |
| 719 | + }; |
| 720 | + $detailView.find('.action.updateDataTestAsync a').click(); |
701 | 721 | }); |
702 | 722 | }(jQuery)); |
0 commit comments