From 24d0bf05a5b3ec24ca67a87e63add6677ac09fa3 Mon Sep 17 00:00:00 2001 From: Julien Collard Date: Thu, 3 Nov 2016 15:26:43 +0100 Subject: [PATCH 01/10] use mock instead of fire method to simulate user tap events --- bower.json | 3 ++- test/paper-buttons-group_test.html | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 2a1836d..fa663ef 100644 --- a/bower.json +++ b/bower.json @@ -34,6 +34,7 @@ "web-component-tester": "^4.0.0", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.20", "iron-icon": "PolymerElements/iron-icon#^1.0.11", - "iron-icons": "PolymerElements/iron-icons#^1.1.3" + "iron-icons": "PolymerElements/iron-icons#^1.1.3", + "iron-test-helpers": "PolymerElements/iron-test-helpers#^1.2.5" } } diff --git a/test/paper-buttons-group_test.html b/test/paper-buttons-group_test.html index 0e2fb76..de720c5 100644 --- a/test/paper-buttons-group_test.html +++ b/test/paper-buttons-group_test.html @@ -7,6 +7,7 @@ + @@ -67,7 +68,7 @@ test('select by taping on a choice works', function () { var element = fixture('simpleChoice'); var choice = document.getElementById("simpleChoice2"); - choice.fire("tap"); + MockInteractions.tap(choice); assert.equal(element.selected, 1); }); @@ -83,10 +84,10 @@ var choice1 = document.getElementById("multiChoice1"); var choice2 = document.getElementById("multiChoice2"); var choice3 = document.getElementById("multiChoice3"); - choice1.fire("tap"); - choice1.fire("tap"); - choice2.fire("tap"); - choice3.fire("tap"); + MockInteractions.tap(choice1); + MockInteractions.tap(choice1); + MockInteractions.tap(choice2); + MockInteractions.tap(choice3); assert.deepEqual(element.selectedValues, [1, 2]); }); From 08556f278e0fc92cc00110ece36c23179a322bee Mon Sep 17 00:00:00 2001 From: Julien Collard Date: Thu, 3 Nov 2016 16:57:32 +0100 Subject: [PATCH 02/10] use setup step to reproduce tests --- test/paper-buttons-group_test.html | 37 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/test/paper-buttons-group_test.html b/test/paper-buttons-group_test.html index de720c5..e8eddbf 100644 --- a/test/paper-buttons-group_test.html +++ b/test/paper-buttons-group_test.html @@ -53,34 +53,40 @@