META-INF.resources.bower_components.angular-bootstrap-datetimepicker.test.configuration.renderOn.spec.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-bootstrap-date-time-picker Show documentation
Show all versions of jwebmp-bootstrap-date-time-picker Show documentation
The JWebSwing implementation for Bootstrap Date Time Picker
describe("renderOn",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 an empty string",function(){function compile(){$compile(' ')($rootScope);$rootScope.$digest()}expect(compile).toThrow(new Error("renderOn must not be an empty string"))});it("if value is numeric",function(){function compile(){$compile(' ')($rootScope);$rootScope.$digest()}expect(compile).toThrow(new Error("renderOn must be a string"))})});describe("does NOT throw exception",function(){it("if value is a string",function(){$compile(' ')($rootScope)})});describe("renderOn event",function(){it("causes view to re-render after event is received",function(){var selectable=true;$rootScope.config={data:{startView:"year",renderOn:"valid-dates-changed"}};$rootScope.beforeRender=function(dates){dates[2].selectable=selectable};spyOn($rootScope,"beforeRender").and.callThrough();var element=$compile(' ')($rootScope);$rootScope.$digest();var selectedElement=jQuery(jQuery(".year",element)[2]);expect(selectedElement.hasClass("disabled")).toBeFalsy();selectable=false;$rootScope.$broadcast("valid-dates-changed");$rootScope.$digest();expect($rootScope.beforeRender.calls.count()).toBe(2);selectedElement=jQuery(jQuery(".year",element)[2]);expect(selectedElement.hasClass("disabled")).toBeTruthy()})})});