Skip to content

Commit

Permalink
Updated tests for mm-button, mm-checkbox, mm-calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
Shuwen Qian committed Sep 3, 2015
1 parent d8e3aad commit ae74059
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions test/mm-button.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down
9 changes: 5 additions & 4 deletions test/mm-calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions test/mm-checkbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand Down

0 comments on commit ae74059

Please sign in to comment.