All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.angular-bootstrap-datetimepicker.test.configuration.minView.spec.js Maven / Gradle / Ivy

There is a newer version: 0.66.0.1
Show newest version
/* globals describe, beforeEach, it, expect, module, inject */

/**
 * @license angular-bootstrap-datetimepicker
 * Copyright 2016 Knight Rider Consulting, Inc. http://www.knightrider.com
 * License: MIT
 *
 * @author        Dale "Ducky" Lotts
 * @since        7/21/13
 */

describe('minView', function () {
  'use strict'
  var $rootScope
  var $compile
  beforeEach(module('ui.bootstrap.datetimepicker'))
  beforeEach(inject(function (_$compile_, _$rootScope_) {
    $compile = _$compile_
    $rootScope = _$rootScope_
    $rootScope.date = null
  }))

  describe('throws exception', function () {
    it('if value is not a valid value', function () {
      function compile () {
        $compile('')($rootScope)
        $rootScope.$digest()
      }

      expect(compile).toThrow(new Error('invalid minView value: bar'))
    })
    it('if value is a numeric value', function () {
      function compile () {
        $compile('')($rootScope)
        $rootScope.$digest()
      }

      expect(compile).toThrow(new Error('invalid minView value: 0'))
    })
    it('if value is greater than startView', function () {
      function compile () {
        $compile('')($rootScope)
        $rootScope.$digest()
      }

      expect(compile).toThrow(new Error('startView must be greater than minView'))
    })
  })
  describe('does NOT throw exception for valid values', function () {
    it('if value is between 1 and 59', function () {
      var validViews = ['year', 'month', 'day', 'hour', 'minute']

      for (var i = 0; i < validViews.length; i += 1) {
        $compile('')($rootScope)
      }
    })
  })
})




© 2015 - 2024 Weber Informatics LLC | Privacy Policy