File: tests/properties/startDate.ts

Recommend this page to a friend!
  Classes of Logik group   Angular Moment Picker   tests/properties/startDate.ts   Download  
File: tests/properties/startDate.ts
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Angular Moment Picker
Pick times and dates in Angular.js applications
Author: By
Last change: Update of tests/properties/startDate.ts
Date: 2 years ago
Size: 1,347 bytes
 

Contents

Class file image Download
import * as angular from 'angular'; import * as moment from 'moment'; import * as test from '../utility'; describe('Property `startDate`', () => { let format = 'YYYY-MM-DD HH:mm:ss', startDate = moment('2005-05-15 13:20:15', format), startDateStr = '\'' + startDate.format(format) + '\'', expectedHeaders = { decade: '2000 - 2009', year: '2005', month: 'May 2005', day: 'May 15, 2005', hour: 'May 15, 2005 1:00 PM', minute: 'May 15, 2005 1:20 PM' }; // init test test.bootstrap(); const getHeaderText = ($element: ng.IAugmentedJQuery) => angular.element(test.getPicker($element).find('.header-view th')[1]).text(); // test all views angular.forEach(expectedHeaders, (expectedHeader, view) => { let viewName = view[0].toUpperCase() + view.slice(1), title = 'should open ' + viewName + ' View in ' + expectedHeader; it(title, () => { let $propAsMoment = test.buildTemplate('div', { locale: 'en', format: format, startView: view, startDate: startDate }), $propAsString = test.buildTemplate('div', { locale: 'en', format: format, startView: view, startDate: startDateStr }); // Moment object input expect(getHeaderText($propAsMoment)).toBe(expectedHeader); // string input expect(getHeaderText($propAsString)).toBe(expectedHeader); }); }); });