(tap, ctrl?)
| 891 | SelectionModeTests.prototype["testDataChangeInSelChangedHandler" + layoutName] = function (complete) { |
| 892 | |
| 893 | function test(tap, ctrl?) { |
| 894 | return new WinJS.Promise(function (complete) { |
| 895 | LiveUnit.LoggingCore.logComment("testing " + tap + " mode"); |
| 896 | var myData = []; |
| 897 | for (var i = 0; i < 10; ++i) { |
| 898 | myData.push({ title: "Tile" + i }); |
| 899 | } |
| 900 | var newNode = document.createElement("div"); |
| 901 | newNode.style.width = "1000px"; |
| 902 | newNode.style.height = "600px"; |
| 903 | document.body.appendChild(newNode); |
| 904 | var listView = new ListView(newNode, { |
| 905 | itemDataSource: (new WinJS.Binding.List(myData)).dataSource, |
| 906 | selectionMode: "multi", |
| 907 | tapBehavior: tap |
| 908 | |
| 909 | }); |
| 910 | listView.addEventListener("selectionchanged", function (eventObject) { |
| 911 | listView.itemDataSource = (new WinJS.Binding.List([])).dataSource; |
| 912 | listView.layout = new WinJS.UI[layoutName](); |
| 913 | }); |
| 914 | |
| 915 | listView._canvas.setPointerCapture = function () { |
| 916 | }; |
| 917 | |
| 918 | Helper.ListView.runTests(listView, [ |
| 919 | function () { |
| 920 | LiveUnit.Assert.areEqual(myData.length, newNode.querySelectorAll(".win-item").length); |
| 921 | click(listView._currentMode(), { target: listView.elementFromIndex(1), ctrlKey: ctrl }); |
| 922 | return true; |
| 923 | }, |
| 924 | function () { |
| 925 | LiveUnit.Assert.areEqual(0, newNode.querySelectorAll(".win-item").length); |
| 926 | document.body.removeChild(newNode); |
| 927 | complete(); |
| 928 | } |
| 929 | ]); |
| 930 | }); |
| 931 | } |
| 932 | |
| 933 | test("invokeOnly", true).then(function () { |
| 934 | if (WinJS.Utilities.isPhone) { |
no test coverage detected