|
| 1 | +/*globals describe, beforeEach, it, expect, module, inject, moment, angular, afterEach, jQuery */ |
| 2 | + |
| 3 | +/** |
| 4 | + * @license angular-bootstrap-datetimepicker |
| 5 | + * Copyright 2013 Knight Rider Consulting, Inc. http://www.knightrider.com |
| 6 | + * License: MIT |
| 7 | + */ |
| 8 | + |
| 9 | +/** |
| 10 | + * |
| 11 | + * @author Dale "Ducky" Lotts |
| 12 | + * @since 10/15/15 |
| 13 | + */ |
| 14 | + |
| 15 | +describe('css styling', function () { |
| 16 | + 'use strict'; |
| 17 | + |
| 18 | + var element = null; |
| 19 | + |
| 20 | + beforeEach(module('ui.bootstrap.datetimepicker')); |
| 21 | + beforeEach(inject(function ($compile, $rootScope) { |
| 22 | + moment.locale('en'); |
| 23 | + $rootScope.date = moment('2013-01-22T00:00:00.000').toDate(); |
| 24 | + element = $compile('<datetimepicker data-ng-model="date"></datetimepicker>')($rootScope); |
| 25 | + angular.element(document).find('body').append(element); |
| 26 | + $rootScope.$digest(); |
| 27 | + })); |
| 28 | + |
| 29 | + it('of `.datetimepicker` should have a width of 320', function () { |
| 30 | + expect(element.width()).toBe(320); |
| 31 | + expect(jQuery(element).css('width')).toBe('320px'); |
| 32 | + }); |
| 33 | + |
| 34 | + describe('of `.active` element', function () { |
| 35 | + |
| 36 | + it('should have a height of 20', function () { |
| 37 | + var activeElement = jQuery('.active', element); |
| 38 | + expect(activeElement.height()).toBe(20); |
| 39 | + }); |
| 40 | + it('should have blue background', function () { |
| 41 | + var activeElement = jQuery('.active', element); |
| 42 | + expect(activeElement.css('background-color')).toBe('rgb(0, 68, 204)'); |
| 43 | + }); |
| 44 | + it('should have white text', function () { |
| 45 | + var activeElement = jQuery('.active', element); |
| 46 | + expect(activeElement.css('color')).toBe('rgb(255, 255, 255)'); |
| 47 | + }); |
| 48 | + }); |
| 49 | + |
| 50 | + |
| 51 | + describe('of `.past` element', function () { |
| 52 | + it('should have grey text', function () { |
| 53 | + var activeElement = jQuery('.past', element); |
| 54 | + expect(activeElement.css('color')).toBe('rgb(153, 153, 153)'); |
| 55 | + }); |
| 56 | + }); |
| 57 | + |
| 58 | + describe('of `.future` element', function () { |
| 59 | + it('should have grey text', function () { |
| 60 | + var activeElement = jQuery('.future', element); |
| 61 | + expect(activeElement.css('color')).toBe('rgb(153, 153, 153)'); |
| 62 | + }); |
| 63 | + }); |
| 64 | + |
| 65 | + afterEach(function () { |
| 66 | + angular.element(document).find('body').remove('.datetimepicker'); |
| 67 | + }); |
| 68 | +}); |
| 69 | + |
0 commit comments