From 10eac7c22b6a2c6be4a7d7023dce60161f99e1ce Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Thu, 4 Feb 2016 21:50:26 -0800 Subject: [PATCH] feat(datepicker): add deprecation notices - Add deprecation notices for datepicker & popup Closes #5415 --- src/datepicker/datepicker.js | 100 +- src/datepicker/test/datepicker.spec.js | 1454 ++++++++++++++++++++++++ template/datepicker/datepicker.html | 2 +- 3 files changed, 1543 insertions(+), 13 deletions(-) diff --git a/src/datepicker/datepicker.js b/src/datepicker/datepicker.js index 48f0bc4ef4..08ea1714c8 100644 --- a/src/datepicker/datepicker.js +++ b/src/datepicker/datepicker.js @@ -1,6 +1,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.isClass', 'ui.bootstrap.position']) .value('$datepickerSuppressError', false) +.value('uibDatepickerAttributeWarning', true) .constant('uibDatepickerConfig', { datepickerMode: 'day', @@ -21,8 +22,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst yearRows: 4 }) -.controller('UibDatepickerController', ['$scope', '$attrs', '$parse', '$interpolate', '$locale', '$log', 'dateFilter', 'uibDatepickerConfig', '$datepickerSuppressError', 'uibDateParser', - function($scope, $attrs, $parse, $interpolate, $locale, $log, dateFilter, datepickerConfig, $datepickerSuppressError, dateParser) { +.controller('UibDatepickerController', ['$scope', '$attrs', '$parse', '$interpolate', '$locale', '$log', 'dateFilter', 'uibDatepickerConfig', '$datepickerSuppressError', 'uibDatepickerAttributeWarning', 'uibDateParser', + function($scope, $attrs, $parse, $interpolate, $locale, $log, dateFilter, datepickerConfig, $datepickerSuppressError, datepickerAttributeWarning, dateParser) { var self = this, ngModelCtrl = { $setViewValue: angular.noop }, // nullModelCtrl; ngModelOptions = {}, @@ -130,15 +131,27 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst // Interpolated configuration attributes angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle'], function(key) { self[key] = angular.isDefined($attrs[key]) ? $interpolate($attrs[key])($scope.$parent) : datepickerConfig[key]; + + if (angular.isDefined($attrs[key]) && datepickerAttributeWarning) { + $log.warn('uib-datepicker ' + key + ' attribute usage is deprecated, use datepicker-options attribute instead'); + } }); // Evaled configuration attributes angular.forEach(['showWeeks', 'yearRows', 'yearColumns', 'shortcutPropagation'], function(key) { self[key] = angular.isDefined($attrs[key]) ? $scope.$parent.$eval($attrs[key]) : datepickerConfig[key]; + + if (angular.isDefined($attrs[key]) && datepickerAttributeWarning) { + $log.warn('uib-datepicker ' + key + ' attribute usage is deprecated, use datepicker-options attribute instead'); + } }); if (angular.isDefined($attrs.startingDay)) { + if (datepickerAttributeWarning) { + $log.warn('uib-datepicker startingDay attribute usage is deprecated, use datepicker-options attribute instead'); + } + self.startingDay = $scope.$parent.$eval($attrs.startingDay); } else if (angular.isNumber(datepickerConfig.startingDay)) { self.startingDay = datepickerConfig.startingDay; @@ -149,6 +162,10 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst // Watchable date attributes angular.forEach(['minDate', 'maxDate'], function(key) { if ($attrs[key]) { + if (datepickerAttributeWarning) { + $log.warn('uib-datepicker ' + key + ' attribute usage is deprecated, use datepicker-options attribute instead'); + } + watchListeners.push($scope.$parent.$watch($attrs[key], function(value) { if (value) { if (angular.isDate(value)) { @@ -169,6 +186,10 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst angular.forEach(['minMode', 'maxMode'], function(key) { if ($attrs[key]) { + if (datepickerAttributeWarning) { + $log.warn('uib-datepicker ' + key + ' attribute usage is deprecated, use datepicker-options attribute instead'); + } + watchListeners.push($scope.$parent.$watch($attrs[key], function(value) { self[key] = $scope[key] = angular.isDefined(value) ? value : $attrs[key]; if (key === 'minMode' && self.modes.indexOf($scope.datepickerMode) < self.modes.indexOf(self[key]) || @@ -182,6 +203,10 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst }); if (angular.isDefined($attrs.initDate)) { + if (datepickerAttributeWarning) { + $log.warn('uib-datepicker initDate attribute usage is deprecated, use datepicker-options attribute instead'); + } + this.activeDate = dateParser.fromTimezone($scope.$parent.$eval($attrs.initDate), ngModelOptions.timezone) || new Date(); watchListeners.push($scope.$parent.$watch($attrs.initDate, function(initDate) { if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) { @@ -194,7 +219,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst } } - $scope.datepickerMode = $scope.datepickerMode || datepickerConfig.datepickerMode; + $scope.datepickerMode = $scope.datepickerMode || + datepickerConfig.datepickerMode; $scope.uniqueId = 'datepicker-' + $scope.$id + '-' + Math.floor(Math.random() * 10000); $scope.disabled = angular.isDefined($attrs.disabled) || false; @@ -673,6 +699,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst }; }) +.value('uibDatepickerPopupAttributeWarning', true) + .constant('uibDatepickerPopupConfig', { altInputFormats: [], appendToBody: false, @@ -692,8 +720,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst showButtonBar: true }) -.controller('UibDatepickerPopupController', ['$scope', '$element', '$attrs', '$compile', '$parse', '$document', '$rootScope', '$uibPosition', 'dateFilter', 'uibDateParser', 'uibDatepickerPopupConfig', '$timeout', 'uibDatepickerConfig', -function(scope, element, attrs, $compile, $parse, $document, $rootScope, $position, dateFilter, dateParser, datepickerPopupConfig, $timeout, datepickerConfig) { +.controller('UibDatepickerPopupController', ['$scope', '$element', '$attrs', '$compile', '$log', '$parse', '$document', '$rootScope', '$uibPosition', 'dateFilter', 'uibDateParser', 'uibDatepickerPopupConfig', '$timeout', 'uibDatepickerConfig', 'uibDatepickerPopupAttributeWarning', +function(scope, element, attrs, $compile, $log, $parse, $document, $rootScope, $position, dateFilter, dateParser, datepickerPopupConfig, $timeout, datepickerConfig, datepickerPopupAttributeWarning) { var cache = {}, isHtml5DateInput = false; var dateFormat, closeOnDateSelection, appendToBody, onOpenFocus, @@ -705,14 +733,50 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi this.init = function(_ngModel_) { ngModel = _ngModel_; ngModelOptions = _ngModel_.$options || datepickerConfig.ngModelOptions; - closeOnDateSelection = angular.isDefined(attrs.closeOnDateSelection) ? scope.$parent.$eval(attrs.closeOnDateSelection) : datepickerPopupConfig.closeOnDateSelection; - appendToBody = angular.isDefined(attrs.datepickerAppendToBody) ? scope.$parent.$eval(attrs.datepickerAppendToBody) : datepickerPopupConfig.appendToBody; - onOpenFocus = angular.isDefined(attrs.onOpenFocus) ? scope.$parent.$eval(attrs.onOpenFocus) : datepickerPopupConfig.onOpenFocus; - datepickerPopupTemplateUrl = angular.isDefined(attrs.datepickerPopupTemplateUrl) ? attrs.datepickerPopupTemplateUrl : datepickerPopupConfig.datepickerPopupTemplateUrl; - datepickerTemplateUrl = angular.isDefined(attrs.datepickerTemplateUrl) ? attrs.datepickerTemplateUrl : datepickerPopupConfig.datepickerTemplateUrl; - altInputFormats = angular.isDefined(attrs.altInputFormats) ? scope.$parent.$eval(attrs.altInputFormats) : datepickerPopupConfig.altInputFormats; + if (angular.isDefined(scope.datepickerOptions)) { + closeOnDateSelection = angular.isDefined(scope.datepickerOptions.closeOnDateSelection) ? + scope.datepickerOptions.closeOnDateSelection : + datepickerPopupConfig.closeOnDateSelection; + appendToBody = angular.isDefined(scope.datepickerOptions.datepickerAppendToBody) ? + scope.datepickerOptions.datepickerAppendToBody : + datepickerPopupConfig.datepickerAppendToBody; + onOpenFocus = angular.isDefined(scope.datepickerOptions.onOpenFocus) ? + scope.datepickerOptions.onOpenFocus : + datepickerPopupConfig.onOpenFocus; + datepickerPopupTemplateUrl = angular.isDefined(scope.datepickerOptions.datepickerPopupTemplateUrl) ? + scope.datepickerOptions.datepickerPopupTemplateUrl : + datepickerPopupConfig.datepickerPopupTemplateUrl; + datepickerTemplateUrl = angular.isDefined(scope.datepickerOptions.datepickerTemplateUrl) ? + scope.datepickerOptions.datepickerTemplateUrl : datepickerPopupConfig.datepickerTemplateUrl; + altInputFormats = angular.isDefined(scope.datepickerOptions.altInputFormats) ? + scope.datepickerOptions.altInputFormats : + datepickerPopupConfig.altInputFormats; + } else { + if (datepickerPopupAttributeWarning) { + $log.warn('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + } - scope.showButtonBar = angular.isDefined(attrs.showButtonBar) ? scope.$parent.$eval(attrs.showButtonBar) : datepickerPopupConfig.showButtonBar; + closeOnDateSelection = angular.isDefined(attrs.closeOnDateSelection) ? + scope.$parent.$eval(attrs.closeOnDateSelection) : + datepickerPopupConfig.closeOnDateSelection; + appendToBody = angular.isDefined(attrs.datepickerAppendToBody) ? + scope.$parent.$eval(attrs.datepickerAppendToBody) : + datepickerPopupConfig.appendToBody; + onOpenFocus = angular.isDefined(attrs.onOpenFocus) ? + scope.$parent.$eval(attrs.onOpenFocus) : datepickerPopupConfig.onOpenFocus; + datepickerPopupTemplateUrl = angular.isDefined(attrs.datepickerPopupTemplateUrl) ? + attrs.datepickerPopupTemplateUrl : + datepickerPopupConfig.datepickerPopupTemplateUrl; + datepickerTemplateUrl = angular.isDefined(attrs.datepickerTemplateUrl) ? + attrs.datepickerTemplateUrl : datepickerPopupConfig.datepickerTemplateUrl; + altInputFormats = angular.isDefined(attrs.altInputFormats) ? + scope.$parent.$eval(attrs.altInputFormats) : + datepickerPopupConfig.altInputFormats; + + scope.showButtonBar = angular.isDefined(attrs.showButtonBar) ? + scope.$parent.$eval(attrs.showButtonBar) : + datepickerPopupConfig.showButtonBar; + } if (datepickerPopupConfig.html5Types[attrs.type]) { dateFormat = datepickerPopupConfig.html5Types[attrs.type]; @@ -774,6 +838,10 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi angular.forEach(['minMode', 'maxMode', 'datepickerMode', 'shortcutPropagation'], function(key) { if (attrs[key]) { + if (key !== 'datepickerMode' && datepickerPopupAttributeWarning) { + $log.warn('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + } + var getAttribute = $parse(attrs[key]); var propConfig = { get: function() { @@ -797,6 +865,10 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi angular.forEach(['minDate', 'maxDate', 'initDate'], function(key) { if (attrs[key]) { + if (datepickerPopupAttributeWarning) { + $log.warn('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + } + var getAttribute = $parse(attrs[key]); watchListeners.push(scope.$parent.$watch(getAttribute, function(value) { @@ -826,6 +898,10 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle', 'showWeeks', 'startingDay', 'yearRows', 'yearColumns'], function(key) { if (angular.isDefined(attrs[key])) { + if (datepickerPopupAttributeWarning) { + $log.warn('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + } + datepickerEl.attr(cameltoDash(key), attrs[key]); } }); diff --git a/src/datepicker/test/datepicker.spec.js b/src/datepicker/test/datepicker.spec.js index a45ced1827..4c2df98106 100644 --- a/src/datepicker/test/datepicker.spec.js +++ b/src/datepicker/test/datepicker.spec.js @@ -205,6 +205,1460 @@ describe('datepicker', function() { }); }); + // TODO: Remove on next minor release + describe('uibDatepickerAttributeWarning', function() { + var $compile, + $log, + $scope; + + it('should not log warning for datepickerOptions usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.opts = {}; + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatDay attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker formatDay attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatDay attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatMonth attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker formatMonth attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatMonth attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatYear attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker formatYear attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatYear attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatDayHeader attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker formatDayHeader attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatDayHeader attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatDayTitle attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker formatDayTitle attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatDayTitle attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatMonthTitle attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker formatMonthTitle attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatMonthTitle attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for showWeeks attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker showWeeks attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for showWeeks attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for shortcutPropagation attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker shortcutPropagation attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for shortcutPropagation attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for yearColumns attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker yearColumns attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for yearColumns attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for yearRows attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker yearRows attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for yearRows attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for minDate attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + $scope.minDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker minDate attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for minDate attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + $scope.minDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for maxDate attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + $scope.maxDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker maxDate attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for maxDate attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + $scope.maxDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for minMode attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker minMode attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for minMode attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for maxMode attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker maxMode attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for maxMode attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for initDate attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + $scope.initDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker initDate attribute usage is deprecated, use datepicker-options attribute instead'); + }); + + it('should suppress warning for initDate attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.locals = { + date: new Date() + }; + $scope.initDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + }); + + // TODO: Remove on next minor release + describe('uibDatepickerPopupAttributeWarning', function() { + var $compile, + $log, + $scope; + + it('should not log warning for datepickerOptions usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + $scope.opts = {}; + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for closeOnDateSelection attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for closeOnDateSelection attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for appendToBody attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for appendToBody attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for onOpenFocus attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for onOpenFocus attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for datepickerPopupTemplateUrl attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for datepickerPopupTemplateUrl attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for datepickerTemplateUrl attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for datepickerTemplateUrl attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for altInputFormats attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + $scope.formats = []; + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for altInputFormats attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + $scope.formats = []; + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for showButtonBar attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for showButtonBar attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for minMode attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for minMode attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for maxMode attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for maxMode attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for shortcutPropagation attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for shortcutPropagation attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for minDate attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + $scope.minDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for minDate attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + $scope.minDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for maxDate attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + $scope.maxDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for maxDate attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + $scope.maxDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for initDate attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + $scope.initDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for initDate attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + $scope.initDate = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatDay attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatDay attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatMonth attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatMonth attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatYear attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatYear attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatDayHeader attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatDayHeader attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatDayTitle attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatDayTitle attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for formatMonthTitle attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for formatMonthTitle attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for showWeeks attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for showWeeks attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for startingDay attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for startingDay attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for yearColumns attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for yearColumns attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + + it('should log warning for yearRows attribute usage', function() { + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).toHaveBeenCalledWith('uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); + }); + + it('should suppress warning for yearRows attribute usage', function() { + module(function($provide) { + $provide.value('uibDatepickerPopupAttributeWarning', false); + }); + inject(function(_$log_, _$rootScope_, _$compile_) { + $log = _$log_; + $scope = _$rootScope_.$new(); + $compile = _$compile_; + }); + + $scope.date = new Date(); + + spyOn($log, 'warn'); + element = $compile('
')($scope); + $scope.$digest(); + + expect($log.warn).not.toHaveBeenCalled(); + }); + }); + describe('', function() { beforeEach(inject(function(_$compile_, _$rootScope_, _$templateCache_) { $compile = _$compile_; diff --git a/template/datepicker/datepicker.html b/template/datepicker/datepicker.html index f315d1f3f4..6099c285fb 100644 --- a/template/datepicker/datepicker.html +++ b/template/datepicker/datepicker.html @@ -2,4 +2,4 @@ - \ No newline at end of file +