Permalink
Browse files

Removed bootstrap code that accidentally weasled it's way into the co…

…debase
  • Loading branch information...
1 parent b381ef8 commit 3ebe92cf7b5240bee06b2acc2d37c5afaafedbfb Dean Sofer committed Oct 29, 2012
View
@@ -16,9 +16,9 @@
var debug = window.ieShivDebug || false,
tags = [ "ngInclude", "ngPluralize", "ngView", "ngSwitch", "uiCurrency", "uiCodemirror", "uiDate", "uiEvent",
- "uiKeypress", "uiMask", "uiMapInfoWindow", "uiMapMarker", "uiMapPolyline", "uiMapPolygon", "uiMapRectangle",
- "uiMapCircle", "uiMapGroundOverlay", "uiModal", "uiReset", "uiScrollfix", "uiSelect2", "uiShow", "uiHide",
- "uiToggle", "uiSortable", "uiTinymce", "accordion", "accordionGroup", "modal", "tabs", "pane"
+ "uiKeypress", "uiKeyup", "uiKeydown", "uiMask", "uiMapInfoWindow", "uiMapMarker", "uiMapPolyline",
+ "uiMapPolygon", "uiMapRectangle", "uiMapCircle", "uiMapGroundOverlay", "uiModal", "uiReset",
+ "uiScrollfix", "uiSelect2", "uiShow", "uiHide", "uiToggle", "uiSortable", "uiTinymce"
];
window.myCustomTags = window.myCustomTags || []; // externally defined by developer using angular-ui directives
@@ -30,8 +30,8 @@
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer') {
var ua = navigator.userAgent;
- var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
- if (re.exec(ua) != null) {
+ var re = new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");
+ if (re.exec(ua) !== null) {
rv = parseFloat(RegExp.$1);
}
}
@@ -1,53 +0,0 @@
-'use strict';
-
-angular.module('ui.directives')
- .directive('uiDropdownToggle', ['ui.config', '$document', '$location', '$window',
- function (uiConfig, $document, $location, $window) {
-
- var options = { }, openElement = null, close;
- if (uiConfig.dropdownToggle) {
- angular.extend(options, uiConfig.dropdownToggle);
- }
- return {
- restrict: 'C',
- link: function(scope, element, attrs) {
-
- scope.$watch(function(){return $location.path();}, function() {
- close && close();
- });
-
- element.parent().bind('click', function(event) {
- close && close();
- });
-
- element.bind('click', function(event) {
- event.preventDefault();
- event.stopPropagation();
-
- var iWasOpen = false;
-
- // Initially, openElement will not have been defined, this code will not execute
- if (openElement) {
- iWasOpen = openElement === element;
- close();
- }
-
- if (!iWasOpen){
- element.parent().addClass('open');
- openElement = element;
-
- close = function (event) {
- event && event.preventDefault();
- event && event.stopPropagation();
- $document.unbind('click', close);
- element.parent().removeClass('open');
- close = null;
- openElement = null;
- }
-
- $document.bind('click', close);
- }
- });
- }
- };
- }]);
@@ -1,112 +0,0 @@
-'use strict';
-
-angular.module('ui.directives')
-.directive('tabbable', ['ui.config', function (uiConfig) {
- var options = { }, openElement = null, close;
- if (uiConfig.tabbable) {
- angular.extend(options, uiConfig.tabbable);
- }
- return {
- restrict: 'C',
- compile: function(element) {
- var navTabs = angular.element('<ul class="nav nav-tabs"></ul>'),
- tabContent = angular.element('<div class="tab-content"></div>');
-
- tabContent.append(element.contents());
- element.append(navTabs).append(tabContent);
- },
- controller: ['$scope', '$element', function($scope, $element) {
- var navTabs = $element.contents().eq(0),
- ngModel = $element.controller('ngModel') || {},
- tabs = [],
- selectedTab;
-
- ngModel.$render = function() {
- var $viewValue = this.$viewValue;
-
- if (selectedTab ? (selectedTab.value != $viewValue) : $viewValue) {
- if(selectedTab) {
- selectedTab.paneElement.removeClass('active');
- selectedTab.tabElement.removeClass('active');
- selectedTab = null;
- }
- if($viewValue) {
- for(var i = 0, ii = tabs.length; i < ii; i++) {
- if ($viewValue == tabs[i].value) {
- selectedTab = tabs[i];
- break;
- }
- }
- if (selectedTab) {
- selectedTab.paneElement.addClass('active');
- selectedTab.tabElement.addClass('active');
- }
- }
-
- }
- };
-
- this.addPane = function(element, attr) {
- var li = angular.element('<li><a href></a></li>'),
- a = li.find('a'),
- tab = {
- paneElement: element,
- paneAttrs: attr,
- tabElement: li
- };
-
- tabs.push(tab);
-
- attr.$observe('value', update)();
- attr.$observe('title', function(){ update(); a.text(tab.title); })();
-
- function update() {
- tab.title = attr.title;
- tab.value = attr.value || attr.title;
- if (!ngModel.$setViewValue && (!ngModel.$viewValue || tab == selectedTab)) {
- // we are not part of angular
- ngModel.$viewValue = tab.value;
- }
- ngModel.$render();
- }
- navTabs.append(li);
- li.bind('click', function(event) {
- event.preventDefault();
- event.stopPropagation();
- if (ngModel.$setViewValue) {
- $scope.$apply(function() {
- ngModel.$setViewValue(tab.value);
- ngModel.$render();
- });
- } else {
- // we are not part of angular
- ngModel.$viewValue = tab.value;
- ngModel.$render();
- }
- });
- return function() {
- tab.tabElement.remove();
- for(var i = 0, ii = tabs.length; i < ii; i++ ) {
- if (tab == tabs[i]) {
- tabs.splice(i, 1);
- }
- }
- };
- }
- }]
- };
-}])
-.directive('tabPane', ['ui.config', function (uiConfig) {
- var options = { }, openElement = null, close;
- if (uiConfig.tabPane) {
- angular.extend(options, uiConfig.tabPane);
- }
- return {
- require: '^tabbable',
- restrict: 'C',
- replace: true,
- link: function(scope, element, attrs, tabsCtrl) {
- element.bind('$remove', tabsCtrl.addPane(element, attrs));
- }
- };
-}]);
@@ -1,170 +0,0 @@
-'use strict';
-
-var toJson = function(arg) {
- return angular.toJson(arg);
-}
-
-describe('uiBootstrap', function() {
- var $compile, $rootScope, element, _jQuery;
- beforeEach(function() {
- _jQuery = jQuery;
- });
- function clickTab(element, index) {
- element.click(element.children().eq(0).children().eq(index))
- // browserTrigger(element.children().eq(0).children().eq(index));
- }
-
- beforeEach(module('ui'));
-
- beforeEach(inject(function(_$compile_, _$rootScope_) {
- $compile = _$compile_;
- $rootScope = _$rootScope_;
- }));
-
- beforeEach(function() {
- function findTab(element, index) {
- return _jQuery(element[0]).find('> .nav-tabs > li').eq(index);
- }
- function findTabPane(element, index) {
- return _jQuery(element[0]).find('> .tab-content > .tab-pane').eq(index);
- }
-
- this.addMatchers({
- toHaveTab: function(index, title) {
- var tab = findTab(element, index);
-
- this.message = function() {
- if (tab.length) {
- return 'Expect tab index ' + index + ' to be ' + toJson(title) + ' but was ' + toJson(tab.text());
- } else {
- return 'Expect tab index ' + index + ' to be ' + toJson(title) + ' but there are only ' +
- element.children().length + ' tabs.';
- }
- };
-
- return tab.length && tab.text() == title;
- },
-
- toHaveTabPane: function(index, title) {
- var tabPane = findTabPane(element, index);
-
- this.message = function() {
- if (tabPane.length) {
- return 'Expect tab pane index ' + index + ' to be ' + toJson(title) + ' but was ' + toJson(tabPane.text());
- } else {
- return 'Expect tab pane index ' + index + ' to be ' + toJson(title) + ' but there are only ' +
- element.children().length + 'tab panes.';
- }
- };
-
- return tabPane.length && tabPane.text() == title;
- },
-
- toHaveSelected: function(index) {
- var tab = findTab(element, index);
- var tabPane = findTabPane(element, index);
-
- this.message = function() {
- return 'Expect tab index ' + index + ' to be selected\n' +
- ' TAB: ' + angular.mock.dump(tab) + '\n' +
- 'TAB-PANE: ' + angular.mock.dump(tabPane);
- };
-
- return tabPane.hasClass('active') && tab.hasClass('active');
- }
- });
- });
-
- afterEach(function() {
- // dealoc(element);
- //delete element;
- });
-
- describe('uiTabbable', function() {
-
- it('should create the right structure', function() {
- element = $compile(
- '<div class="tabbable">' +
- '<div class="tab-pane" title="first">tab1</div>' +
- '<div class="tab-pane" title="second">tab2</div>' +
- '</div>')($rootScope);
-
- $rootScope.$apply();
-
- expect(element).toBeDefined();
-
- expect(element).toHaveTab(0, 'first');
- expect(element).toHaveTab(1, 'second');
-
- expect(element).toHaveTabPane(0, 'tab1');
- expect(element).toHaveTabPane(1, 'tab2');
-
- expect(element).toHaveSelected(0);
- });
-
-
- xit('should respond to tab click', function(){
- element = $compile(
- '<div class="tabbable">' +
- '<div class="tab-pane" title="first">tab1</div>' +
- '<div class="tab-pane" title="second">tab2</div>' +
- '</div>')($rootScope);
-
- expect(element).toBeDefined();
- expect(element).toHaveSelected(0);
- clickTab(element, 1);
- expect(element).toHaveSelected(1);
- });
-
-
- it('should select the first tab in repeater', function() {
- element = $compile(
- '<div class="tabbable">' +
- '<div class="tab-pane" ng-repeat="id in [1,2,3]" title="Tab {{id}}" value="tab-{{id}}">' +
- 'Tab content {{id}}!' +
- '</div>' +
- '</div>')($rootScope);
- $rootScope.$apply();
-
- expect(element).toHaveSelected(0);
- });
-
-
- describe('ngModel', function() {
- xit('should bind to model', function() {
- $rootScope.tab = 'B';
-
- element = $compile(
- '<div class="tabbable" ng-model="tab">' +
- '<div class="tab-pane" title="first" value="A">tab1</div>' +
- '<div class="tab-pane" title="second" value="B">tab2</div>' +
- '</div>')($rootScope);
-
- $rootScope.$apply();
- expect(element).toHaveSelected(1);
-
- $rootScope.tab = 'A';
- $rootScope.$apply();
- expect(element).toHaveSelected(0);
-
- clickTab(element, 1);
- expect($rootScope.tab).toEqual('B');
- expect(element).toHaveSelected(1);
- });
-
-
- it('should not overwrite the model', function() {
- $rootScope.tab = 'tab-2';
- element = $compile(
- '<div class="tabbable" ng-model="tab">' +
- '<div class="tab-pane" ng-repeat="id in [1,2,3]" title="Tab {{id}}" value="tab-{{id}}">' +
- 'Tab content {{id}}!' +
- '</div>' +
- '</div>')($rootScope);
- $rootScope.$apply();
-
- expect(element).toHaveSelected(1);
- });
- });
- });
-});

0 comments on commit 3ebe92c

Please sign in to comment.