diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-15 03:00:53 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-15 03:00:53 +0200 |
commit | 3ce894af1e72c9488b8cb3340fd61656122f7d50 (patch) | |
tree | a603121e8b1e860201370399f8095121cd9c6bf7 /js/vendor/angular-ui/modules/directives | |
parent | 10d76fff64363ea59d916b550854cf3540dadfbc (diff) |
use markdown, refactor js
Diffstat (limited to 'js/vendor/angular-ui/modules/directives')
52 files changed, 0 insertions, 3872 deletions
diff --git a/js/vendor/angular-ui/modules/directives/animate/animate.js b/js/vendor/angular-ui/modules/directives/animate/animate.js deleted file mode 100644 index 430874bb0..000000000 --- a/js/vendor/angular-ui/modules/directives/animate/animate.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Animates the injection of new DOM elements by simply creating the DOM with a class and then immediately removing it - * Animations must be done using CSS3 transitions, but provide excellent flexibility - * - * @todo Add proper support for animating out - * @param [options] {mixed} Can be an object with multiple options, or a string with the animation class - * class {string} the CSS class(es) to use. For example, 'ui-hide' might be an excellent alternative class. - * @example <li ng-repeat="item in items" ui-animate=" 'ui-hide' ">{{item}}</li> - */ -angular.module('ui.directives').directive('uiAnimate', ['ui.config', '$timeout', function (uiConfig, $timeout) { - var options = {}; - if (angular.isString(uiConfig.animate)) { - options['class'] = uiConfig.animate; - } else if (uiConfig.animate) { - options = uiConfig.animate; - } - return { - restrict: 'A', // supports using directive as element, attribute and class - link: function ($scope, element, attrs) { - var opts = {}; - if (attrs.uiAnimate) { - opts = $scope.$eval(attrs.uiAnimate); - if (angular.isString(opts)) { - opts = {'class': opts}; - } - } - opts = angular.extend({'class': 'ui-animate'}, options, opts); - - element.addClass(opts['class']); - $timeout(function () { - element.removeClass(opts['class']); - }, 20, false); - } - }; -}]); - diff --git a/js/vendor/angular-ui/modules/directives/animate/test/animateSpec.js b/js/vendor/angular-ui/modules/directives/animate/test/animateSpec.js deleted file mode 100644 index 219f499a8..000000000 --- a/js/vendor/angular-ui/modules/directives/animate/test/animateSpec.js +++ /dev/null @@ -1,71 +0,0 @@ -/* - * sample unit testing for sample templates and implementations - */ -describe('uiAnimate', function () { - - // declare these up here to be global to all tests - var $rootScope, $compile, $timeout, uiConfig = angular.module('ui.config'); - - beforeEach(module('ui.directives')); - - // inject in angular constructs. Injector knows about leading/trailing underscores and does the right thing - // otherwise, you would need to inject these into each test - beforeEach(inject(function (_$rootScope_, _$compile_, _$timeout_) { - $rootScope = _$rootScope_; - $compile = _$compile_; - $timeout = _$timeout_; - })); - - afterEach(function () { - uiConfig.value('ui.config', {}); - }); - - describe('behavior', function () { - it('should add a ui-animate class when the dom is compiled', function () { - var element = $compile('<div ui-animate></div>')($rootScope); - expect(element.hasClass('ui-animate')).toBeTruthy(); - }); - it('should remove the ui-animate class immediately after injection', function () { - var element = $compile('<div ui-animate></div>')($rootScope); - $timeout.flush(); - expect(element.hasClass('ui-animate')).toBeFalsy(); - }); - - }); - - describe('options', function () { - describe('passed', function () { - - it('should use a string as the class', function () { - var element = $compile('<div ui-animate=" \'ui-hide\' "></div>')($rootScope); - expect(element.hasClass('ui-hide')).toBeTruthy(); - }); - it('should use an object\'s class attribute as the class', function () { - var element = $compile('<div ui-animate=" { \'class\' : \'ui-hide\' } "></div>')($rootScope); - expect(element.hasClass('ui-hide')).toBeTruthy(); - }); - - }); - describe('global', function () { - - var uiConfig; - beforeEach(inject(function ($injector) { - uiConfig = $injector.get('ui.config'); - })); - - it('should use a string as the class', function () { - uiConfig.animate = 'ui-hide-global'; - var element = $compile('<div ui-animate></div>')($rootScope); - expect(element.hasClass('ui-hide-global')).toBeTruthy(); - }); - - it('should use an object\'s class attribute as the class', function () { - uiConfig.animate = { 'class': 'ui-hide-global' }; - var element = $compile('<div ui-animate></div>')($rootScope); - expect(element.hasClass('ui-hide-global')).toBeTruthy(); - }); - - }); - }); - -}); diff --git a/js/vendor/angular-ui/modules/directives/calendar/calendar.js b/js/vendor/angular-ui/modules/directives/calendar/calendar.js deleted file mode 100644 index 9aca0b057..000000000 --- a/js/vendor/angular-ui/modules/directives/calendar/calendar.js +++ /dev/null @@ -1,66 +0,0 @@ -/* -* AngularJs Fullcalendar Wrapper for the JQuery FullCalendar -* API @ http://arshaw.com/fullcalendar/ -* -* Angular Calendar Directive that takes in the [eventSources] nested array object as the ng-model and watches (eventSources.length + eventSources[i].length) for changes. -* Can also take in multiple event urls as a source object(s) and feed the events per view. -* The calendar will watch any eventSource array and update itself when a delta is created -* An equalsTracker attrs has been added for use cases that would render the overall length tracker the same even though the events have changed to force updates. -* -*/ - -angular.module('ui.directives').directive('uiCalendar',['ui.config', '$parse', function (uiConfig,$parse) { - uiConfig.uiCalendar = uiConfig.uiCalendar || {}; - //returns calendar - return { - require: 'ngModel', - restrict: 'A', - link: function(scope, elm, attrs, $timeout) { - var sources = scope.$eval(attrs.ngModel); - var tracker = 0; - /* returns the length of all source arrays plus the length of eventSource itself */ - var getSources = function () { - var equalsTracker = scope.$eval(attrs.equalsTracker); - tracker = 0; - angular.forEach(sources,function(value,key){ - if(angular.isArray(value)){ - tracker += value.length; - } - }); - if(angular.isNumber(equalsTracker)){ - return tracker + sources.length + equalsTracker; - }else{ - return tracker + sources.length; - } - }; - /* update the calendar with the correct options */ - function update() { - //calendar object exposed on scope - scope.calendar = elm.html(''); - var view = scope.calendar.fullCalendar('getView'); - if(view){ - view = view.name; //setting the default view to be whatever the current view is. This can be overwritten. - } - /* If the calendar has options added then render them */ - var expression, - options = { - defaultView : view, - eventSources: sources - }; - if (attrs.uiCalendar) { - expression = scope.$eval(attrs.uiCalendar); - } else { - expression = {}; - } - angular.extend(options, uiConfig.uiCalendar, expression); - scope.calendar.fullCalendar(options); - } - update(); - /* watches all eventSources */ - scope.$watch(getSources, function( newVal, oldVal ) - { - update(); - }); - } - }; -}]);
\ No newline at end of file diff --git a/js/vendor/angular-ui/modules/directives/calendar/dependencies.json b/js/vendor/angular-ui/modules/directives/calendar/dependencies.json deleted file mode 100644 index c700ce2ce..000000000 --- a/js/vendor/angular-ui/modules/directives/calendar/dependencies.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "core": [ "jquery" ], - "internal": [], - "external": [ - "http://arshaw.com/js/fullcalendar-1.5.4/fullcalendar/fullcalendar.css", - "http://arshaw.com/js/fullcalendar-1.5.4/fullcalendar/fullcalendar.js" - ] -}
\ No newline at end of file diff --git a/js/vendor/angular-ui/modules/directives/calendar/test/calendarSpec.js b/js/vendor/angular-ui/modules/directives/calendar/test/calendarSpec.js deleted file mode 100644 index b3e9ac01b..000000000 --- a/js/vendor/angular-ui/modules/directives/calendar/test/calendarSpec.js +++ /dev/null @@ -1,216 +0,0 @@ -/*global beforeEach, afterEach, describe, it, inject, expect, module, spyOn, fullcalendar, angular, $*/ -describe('uiCalendar', function () { - 'use strict'; - - var scope, $compile; - - beforeEach(module('ui')); - beforeEach(inject(function (_$rootScope_, _$compile_) { - scope = _$rootScope_.$new(); - $compile = _$compile_; - - - //Date Objects needed for event - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); - - // create an array of events, to pass into the directive. - scope.events = [ - {title: 'All Day Event',start: new Date(y, m, 1),url: 'http://www.angularjs.org'}, - {title: 'Long Event',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)}, - {id: 999,title: 'Repeating Event',start: new Date(y, m, d - 3, 16, 0),allDay: false}, - {id: 999,title: 'Repeating Event',start: new Date(y, m, d + 4, 16, 0),allDay: true}]; - - // create an array of events, to pass into the directive. - scope.events2 = [ - {title: 'All Day Event 2',start: new Date(y, m, 1),url: 'http://www.atlantacarlocksmith.com'}, - {title: 'Long Event 2',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)}, - {id: 998,title: 'Repeating Event 2',start: new Date(y, m, d - 3, 16, 0),allDay: false}, - {id: 998,title: 'Repeating Event 2',start: new Date(y, m, d + 4, 16, 0),allDay: true}]; - //array to test equalsTracker with - scope.events3 = [ - {title: 'All Day Event 3',start: new Date(y, m, 1),url: 'http://www.atlantacarlocksmith.com'}, - {title: 'Long Event 3',start: new Date(y, m, d - 5),end: new Date(y, m, d - 2)}, - {id: 998,title: 'Repeating Event 3',start: new Date(y, m, d - 3, 16, 0),allDay: false}, - {id: 998,title: 'Repeating Event 3',start: new Date(y, m, d + 4, 16, 0),allDay: true}]; - - // create an array of events, to pass into the directive. - scope.events4 = [{title: 'All Day Event 3',start: new Date(y, m, 1),url: 'http://www.yoyoyo.com'}]; - - //equalsTracker to force the calendar to update on rare occasions - //ie... an event source is replacing another and has the same length as the prior eventSource - //or... replacing an eventSource that is an object with another eventSource - scope.equalsTracker = 0; - - //event Sources array - scope.eventSources = [scope.events,scope.events2]; //End of Events Array - - scope.addSource = function(source) { - scope.eventSources.push(source); - }; - - scope.addChild = function(array) { - array.push({ - title: 'Click for Google ' + scope.events.length, - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - }); - }; - - scope.remove = function(array,index) { - array.splice(index,1); - }; - - scope.uiConfig = { - calendar:{ - height: 200, - weekends: false, - defaultView: 'month' - } - }; - - })); - - afterEach(function() { - angular.module('ui.config').value('ui.config', {}); // cleanup - }); - - describe('compiling this directive and checking for events inside the calendar', function () { - - - /* test the calendar's events length */ - it('should excpect to load 4 events to scope', function () { - spyOn($.fn, 'fullCalendar'); - $compile('<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>')(scope); - expect($.fn.fullCalendar.mostRecentCall.args[0].eventSources[0].length).toBe(4); - }); - /* test to check the title of the first event. */ - it('should excpect to be All Day Event', function () { - spyOn($.fn, 'fullCalendar'); - $compile('<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>')(scope); - expect($.fn.fullCalendar.mostRecentCall.args[0].eventSources[0][0].title).toBe('All Day Event'); - }); - /* test to make sure the event has a url assigned to it. */ - it('should expect the url to = http://www.angularjs.org', function () { - spyOn($.fn, 'fullCalendar'); - $compile('<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>')(scope); - expect($.fn.fullCalendar.mostRecentCall.args[0].eventSources[0][0].url).toBe('http://www.angularjs.org'); - expect($.fn.fullCalendar.mostRecentCall.args[0].eventSources[1][0].url).toBe('http://www.atlantacarlocksmith.com'); - }); - /* test the 3rd events' allDay field. */ - it('should expect the fourth Events all Day field to equal true', function () { - spyOn($.fn, 'fullCalendar'); - $compile('<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>')(scope); - expect($.fn.fullCalendar.mostRecentCall.args[0].eventSources[0][3].allDay).toNotBe(false); - }); - /* Tests the height of the calendar. */ - it('should expect the calendar attribute height to be 200', function () { - spyOn($.fn, 'fullCalendar'); - $compile('<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>')(scope); - expect($.fn.fullCalendar.mostRecentCall.args[0].height).toEqual(200); - }); - /* Tests the weekends boolean of the calendar. */ - it('should expect the calendar attribute weekends to be false', function () { - spyOn($.fn, 'fullCalendar'); - $compile('<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>')(scope); - expect($.fn.fullCalendar.mostRecentCall.args[0].weekends).toEqual(false); - }); - /* Test to make sure that when an event is added to the calendar everything is updated with the new event. */ - it('should expect the scopes events to increase by 2', function () { - spyOn($.fn, 'fullCalendar'); - $compile('<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>')(scope); - expect($.fn.fullCalendar.mostRecentCall.args[0].eventSources[0].length).toEqual(4); - scope.addChild(scope.events); - scope.addChild(scope.events); - expect($.fn.fullCalendar.mostRecentCall.args[0].eventSources[0].length).toEqual(6); - }); - /* Test to make sure the calendar is updating itself on changes to events length. */ - it('should expect the calendar to update itself with new events', function () { - spyOn($.fn, 'fullCalendar'); - $compile('<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>')(scope); - var clientEventsLength = $.fn.fullCalendar.mostRecentCall.args[0].eventSources[0].length; - expect(clientEventsLength).toEqual(4); - //remove an event from the scope. - scope.remove(scope.events,0); - //events should auto update inside the calendar. - clientEventsLength = $.fn.fullCalendar.mostRecentCall.args[0].eventSources[0].length; - expect(clientEventsLength).toEqual(3); - }); - /* Test to make sure header options can be overwritten */ - it('should overwrite default header options', function () { - spyOn($.fn, 'fullCalendar'); - scope.uiConfig2 = { - calendar:{ - header: {center: 'title'} - } - }; - $compile('<div ui-calendar="uiConfig2.calendar" ng-model="eventSources"></div>')(scope); - expect($.fn.fullCalendar.mostRecentCall.args[0].hasOwnProperty('header')).toEqual(true); - var header = $.fn.fullCalendar.mostRecentCall.args[0].header; - expect(header).toEqual({center: 'title'}); - }); - /* Test to see if calendar is watching all eventSources for changes. */ - it('should update the calendar if any eventSource array contains a delta', function () { - spyOn($.fn, 'fullCalendar'); - $compile('<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>')(scope); - var clientEventsLength = $.fn.fullCalendar.mostRecentCall.args[0].eventSources[0].length; - var clientEventsLength2 = $.fn.fullCalendar.mostRecentCall.args[0].eventSources[1].length; - expect(clientEventsLength).toEqual(4); - expect(clientEventsLength2).toEqual(4); - //remove an event from the scope. - scope.remove(scope.events2,0); - //events should auto update inside the calendar. - clientEventsLength = $.fn.fullCalendar.mostRecentCall.args[0].eventSources[0].length; - clientEventsLength2 = $.fn.fullCalendar.mostRecentCall.args[0].eventSources[1].length; - expect(clientEventsLength).toEqual(4); - expect(clientEventsLength2).toEqual(3); - scope.remove(scope.events,0); - clientEventsLength = $.fn.fullCalendar.mostRecentCall.args[0].eventSources[0].length; - expect(clientEventsLength).toEqual(3); - }); - /* Test to se |