From ae74059cded373ef4a635be78620ed2ff6047d10 Mon Sep 17 00:00:00 2001 From: Shuwen Qian Date: Thu, 3 Sep 2015 16:45:07 -0500 Subject: [PATCH] Updated tests for mm-button, mm-checkbox, mm-calendar --- test/mm-button.html | 6 +++--- test/mm-calendar.html | 9 +++++---- test/mm-checkbox.html | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/test/mm-button.html b/test/mm-button.html index 7073b3bd..ea5c3f89 100644 --- a/test/mm-button.html +++ b/test/mm-button.html @@ -37,7 +37,7 @@ color = a.PRIMARY_ICON_COLOR; setTimeout(function() { - a.items[0].getAttribute("primaryColor").should.equal(color); + Polymer.dom(a).querySelector("mm-icon").getAttribute("primary-color").should.equal(color); done(); }, 150); }); @@ -68,7 +68,7 @@ it("button color should be Colors.A2 if type 'secondary'", function(done) { var a = document.querySelector("#btnSec"), - bInner = a.shadowRoot.querySelector(".button"), + bInner = Polymer.dom(a.root).querySelector(".button"), secondaryColor = TestHelper.hexToRgb(Colors.A2), color = null; @@ -81,7 +81,7 @@ it("button color should be Colors.D0 if type 'primary'", function(done) { var a = document.querySelector("#btnIcon"), - bInner = a.shadowRoot.querySelector(".button"), + bInner = Polymer.dom(a.root).querySelector(".button"), primaryColor = TestHelper.hexToRgb(Colors.D0), color = null; diff --git a/test/mm-calendar.html b/test/mm-calendar.html index 07b1d48b..e06f3574 100644 --- a/test/mm-calendar.html +++ b/test/mm-calendar.html @@ -20,7 +20,7 @@ it("should generate a list of days around the current date by default", function() { var t1 = document.querySelector("#test1"); - var active = t1.days.filter(function(day) { + var active = t1._days.filter(function(day) { return day.class.active; }); var st = moment().startOf('month'); @@ -35,8 +35,8 @@ it("should pack the current calendar with pre/post month dates to keep a consistent size", function() { var t1 = document.querySelector("#test1"); var month = moment().startOf('month'); - t1.days[0].moment.isBefore(month).should.be.true; - t1.days[t1.days.length-1].moment.isAfter(month).should.be.true; + t1._days[0].moment.isBefore(month).should.be.true; + t1._days[t1._days.length-1].moment.isAfter(month).should.be.true; }); it("should move the month view when the buttons are pressed", function(done) { @@ -69,9 +69,10 @@ t3.date = moment("01-01-2001").toDate(); t3.pairDate = moment("01-01-2001").add(6, 'days').toDate(); flush(function() { - var sel = t3.days.filter(function(day) { + var sel = t3._days.filter(function(day) { return day.class.selected; }); + console.log(sel); sel[0].class.first.should.be.true; sel[6].class.last.should.be.true; sel.should.have.length(7); diff --git a/test/mm-checkbox.html b/test/mm-checkbox.html index 0e7b0ea0..6ae693a3 100644 --- a/test/mm-checkbox.html +++ b/test/mm-checkbox.html @@ -43,7 +43,7 @@ it("should have a style of 'selected' applied to the inner #checkbox div", function(done) { var a = document.querySelector("#cbx"), - aInner = a.shadowRoot.querySelector("._mm_checkbox"), + aInner = Polymer.dom(a.root).querySelector("#checkbox"), cssClass = "selected", hasSelected = null; @@ -68,7 +68,7 @@ it("the inner icon color should be 'Colors.D0' if default", function(done) { var a = document.querySelector("#cbx"), - aInner = a.shadowRoot.querySelector("mm-icon").shadowRoot.querySelector("#iconGlyph"), + aInner = Polymer.dom(a.root).querySelector("mm-icon").$.iconGlyph, expectedColor = TestHelper.hexToRgb(Colors.D0), color = null; @@ -81,7 +81,7 @@ it("should set icon primaryColor if custom icon is set", function(done) { var a = document.querySelector("#cbxIcon"), - aInner = a.shadowRoot.querySelector("mm-icon"), + aInner = Polymer.dom(a.root).querySelector("mm-icon"), expectedColor = a.iconColor, color = null;