Skip to content
Browse files

Adding tests to displayHour, displayMinutes and displaySeconds proper…

…ties
  • Loading branch information...
1 parent 67b0e7c commit 8f4c86e91df90506eddd979fca5fb4d632159d41 @leohackin leohackin committed Feb 25, 2012
Showing with 68 additions and 0 deletions.
  1. +68 −0 test/spec.js
View
68 test/spec.js
@@ -307,6 +307,74 @@ describe('Chrony', function() {
jasmine.Clock.tick(1000 * 60 * 60);
expect($time).toHaveAttr('style', 'color: rgb(0, 255, 0);');
});
+
+ it('should not display hours digits', function() {
+ // given
+ var $time = $('#time');
+
+ // when
+ $time.chrony({ minutes: 20, displayHours: false});
+ $firstColon = $time.children('span').eq(0),
+ $secondColon = $time.children('span').eq(1),
+
+ // then
+ expect($time).not.toContain('div#hour');
+ expect($time).toContain('div#minute');
+ expect($time).toContain('div#second');
+ expect($firstColon).toExist();
+ expect($secondColon).not.toExist();
+ });
+
+ it('should not display minutes digits', function() {
+ // given
+ var $time = $('#time');
+
+ // when
+ $time.chrony({ seconds: 20, displayMinutes: false});
+ $firstColon = $time.children('span').eq(0),
+ $secondColon = $time.children('span').eq(1),
+
+ // then
+ expect($time).toContain('div#hour');
+ expect($time).not.toContain('div#minute');
+ expect($time).toContain('div#second');
+ expect($firstColon).toExist();
+ expect($secondColon).not.toExist();
+ });
+
+ it('should not display seconds digits', function() {
+ // given
+ var $time = $('#time');
+
+ // when
+ $time.chrony({ minutes: 20, displaySeconds: false});
+ $firstColon = $time.children('span').eq(0),
+ $secondColon = $time.children('span').eq(1),
+
+ // then
+ expect($time).toContain('div#hour');
+ expect($time).toContain('div#minute');
+ expect($time).not.toContain('div#second');
+ expect($firstColon).toExist();
+ expect($secondColon).not.toExist();
+ });
+
+ it('should not display minutes and seconds digits', function() {
+ // given
+ var $time = $('#time');
+
+ // when
+ $time.chrony({ hours: 20, displayMinutes: false, displaySeconds: false});
+ $firstColon = $time.children('span').eq(0),
+ $secondColon = $time.children('span').eq(1),
+
+ // then
+ expect($time).toContain('div#hour');
+ expect($time).not.toContain('div#minute');
+ expect($time).not.toContain('div#second');
+ expect($firstColon).not.toExist();
+ expect($secondColon).not.toExist();
+ });
});

0 comments on commit 8f4c86e

Please sign in to comment.
Something went wrong with that request. Please try again.