Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
get to only 242 failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Grainger committed Aug 2, 2017
1 parent 1d90722 commit 0857fdb
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 83 deletions.
5 changes: 3 additions & 2 deletions src/components/datepicker/js/calendarMonth.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
*/
CalendarMonthCtrl.prototype.changeSelectedDate = function(date) {
var self = this;
var $document = this.$document;
var calendarCtrl = self.calendarCtrl;
var previousSelectedDate = calendarCtrl.selectedDate;
calendarCtrl.selectedDate = date;
Expand All @@ -175,7 +176,7 @@

// Remove the selected class from the previously selected date, if any.
if (previousSelectedDate) {
var prevDateCell = this.$document[0].getElementById(calendarCtrl.getDateId(previousSelectedDate, namespace));
var prevDateCell = $document[0].getElementById(calendarCtrl.getDateId(previousSelectedDate, namespace));
if (prevDateCell) {
prevDateCell.classList.remove(selectedDateClass);
prevDateCell.setAttribute('aria-selected', 'false');
Expand All @@ -184,7 +185,7 @@

// Apply the select class to the new selected date if it is set.
if (date) {
var dateCell = this.$document[0].getElementById(calendarCtrl.getDateId(date, namespace));
var dateCell = $document[0].getElementById(calendarCtrl.getDateId(date, namespace));
if (dateCell) {
dateCell.classList.add(selectedDateClass);
dateCell.setAttribute('aria-selected', 'true');
Expand Down
8 changes: 6 additions & 2 deletions src/components/datepicker/js/datepickerDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@
/** @final */
this.$window = $window;

// Super secret window that the tests don't muck with.
/** @final */
this.$$window = $window;

/** @final */
this.dateUtil = $$mdDateUtil;

Expand Down Expand Up @@ -770,7 +774,7 @@
* @param {Event} event
*/
DatePickerCtrl.prototype.openCalendarPane = function(event) {
var $window = this.$window;
var $$window = this.$$window;
if (!this.isCalendarOpen && !this.isDisabled && !this.inputFocusedOnWindowBlur) {
this.isCalendarOpen = this.isOpen = true;
this.calendarPaneOpenedFrom = event.target;
Expand All @@ -796,7 +800,7 @@
self.documentElement.on('click touchstart', self.bodyClickHandler);
}, false);

$window.addEventListener(this.windowEventName, this.windowEventHandler);
$$window.addEventListener(this.windowEventName, this.windowEventHandler);
}
};

Expand Down
127 changes: 65 additions & 62 deletions src/components/icon/js/iconService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'mdCalendar': 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTkgM2gtMVYxaC0ydjJIOFYxSDZ2Mkg1Yy0xLjExIDAtMS45OS45LTEuOTkgMkwzIDE5YzAgMS4xLjg5IDIgMiAyaDE0YzEuMSAwIDItLjkgMi0yVjVjMC0xLjEtLjktMi0yLTJ6bTAgMTZINVY4aDE0djExek03IDEwaDV2NUg3eiIvPjwvc3ZnPg==',
'mdChecked': 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxnPjxwYXRoIGQ9Ik05IDE2LjE3TDQuODMgMTJsLTEuNDIgMS40MUw5IDE5IDIxIDdsLTEuNDEtMS40MXoiLz48L2c+PC9zdmc+'
})
.provider('$mdIcon', MdIconProvider);
.provider('$mdIcon', mdIconProvider);

/**
* @ngdoc service
Expand Down Expand Up @@ -277,83 +277,86 @@
*
*/

var config = {
defaultViewBoxSize: 24,
defaultFontSet: 'material-icons',
fontSets: []
};
function mdIconProvider() {
var config = {
defaultViewBoxSize: 24,
defaultFontSet: 'material-icons',
fontSets: []
};

function MdIconProvider() {
}

MdIconProvider.prototype = {
icon: function(id, url, viewBoxSize) {
if (id.indexOf(':') == -1) id = '$default:' + id;

config[id] = new ConfigurationItem(url, viewBoxSize);
return this;
},

iconSet: function(id, url, viewBoxSize) {
config[id] = new ConfigurationItem(url, viewBoxSize);
return this;
},
function configItem(url, viewBoxSize) {
return new ConfigurationItem(url, viewBoxSize || config.defaultViewBoxSize);
}

defaultIconSet: function(url, viewBoxSize) {
var setName = '$default';
return {
icon: function(id, url, viewBoxSize) {
if (id.indexOf(':') == -1) id = '$default:' + id;

if (!config[setName]) {
config[setName] = new ConfigurationItem(url, viewBoxSize);
}
config[id] = configItem(url, viewBoxSize);
return this;
},

config[setName].viewBoxSize = viewBoxSize || config.defaultViewBoxSize;
iconSet: function(id, url, viewBoxSize) {
config[id] = configItem(url, viewBoxSize);
return this;
},

return this;
},
defaultIconSet: function(url, viewBoxSize) {
var setName = '$default';

defaultViewBoxSize: function(viewBoxSize) {
config.defaultViewBoxSize = viewBoxSize;
return this;
},
if (!config[setName]) {
config[setName] = configItem(url, viewBoxSize);
}

/**
* Register an alias name associated with a font-icon library style ;
*/
fontSet: function fontSet(alias, className) {
config.fontSets.push({
alias: alias,
fontSet: className || alias
});
return this;
},
config[setName].viewBoxSize = viewBoxSize || config.defaultViewBoxSize;

/**
* Specify a default style name associated with a font-icon library
* fallback to Material Icons.
*
*/
defaultFontSet: function defaultFontSet(className) {
config.defaultFontSet = !className ? '' : className;
return this;
},
return this;
},

defaultIconSize: function defaultIconSize(iconSize) {
config.defaultIconSize = iconSize;
return this;
},
defaultViewBoxSize: function(viewBoxSize) {
config.defaultViewBoxSize = viewBoxSize;
return this;
},

$get: ['$templateRequest', '$q', '$log', '$mdUtil', '$sce', function($templateRequest, $q, $log, $mdUtil, $sce) {
return MdIconService(config, $templateRequest, $q, $log, $mdUtil, $sce);
}]
};
/**
* Register an alias name associated with a font-icon library style ;
*/
fontSet: function fontSet(alias, className) {
config.fontSets.push({
alias: alias,
fontSet: className || alias
});
return this;
},

/**
* Specify a default style name associated with a font-icon library
* fallback to Material Icons.
*
*/
defaultFontSet: function defaultFontSet(className) {
config.defaultFontSet = !className ? '' : className;
return this;
},

defaultIconSize: function defaultIconSize(iconSize) {
config.defaultIconSize = iconSize;
return this;
},

$get: ['$injector', function($injector) {
return $injector.invoke(mdIconService, undefined, { config: config });
}]
};
}

/**
* Configuration item stored in the Icon registry; used for lookups
* to load if not already cached in the `loaded` cache
*/
function ConfigurationItem(url, viewBoxSize) {
this.url = url;
this.viewBoxSize = viewBoxSize || config.defaultViewBoxSize;
this.viewBoxSize = viewBoxSize;
}

/**
Expand Down Expand Up @@ -400,7 +403,7 @@ function ConfigurationItem(url, viewBoxSize) {
*/

/* @ngInject */
function MdIconService(config, $templateRequest, $q, $log, $mdUtil, $sce, $window) {
function mdIconService(config, $templateRequest, $q, $log, $mdUtil, $sce, $window) {
var iconCache = {};
var svgCache = {};
var urlRegex = /[-\w@:%+.~#?&//=]{2,}\.[a-z]{2,4}\b(\/[-\w@:%+.~#?&//=]*)?/i;
Expand Down
4 changes: 2 additions & 2 deletions src/components/panel/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1385,8 +1385,8 @@ function MdPanelRef(config, $injector) {
/** @private @const {!angular.$window} */
this._$window = $injector.get('$window');

/** @private @const {!angular.$window} */
this._$window = $injector.get('$window');
/** @private @const {!angular.$document} */
this._$document = $injector.get('$document');

/** @private @const {!Function} */
this._$$rAF = $injector.get('$$rAF');
Expand Down
11 changes: 3 additions & 8 deletions src/core/services/aria/aria.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function MdAriaProvider() {

return {
disableWarnings: disableWarnings,
$get: function($$rAF, $log, $window, $interpolate) {
return MdAriaService.apply(config, arguments);
$get: function($injector) {
return $injector.invoke(mdAriaService, undefined, config);
}
};

Expand All @@ -55,12 +55,7 @@ function MdAriaProvider() {
/*
* @ngInject
*/
function MdAriaService($$rAF, $log, $window, $interpolate, $document) {

// Load the showWarnings option from the current context and store it inside of a scope variable,
// because the context will be probably lost in some function calls.
var showWarnings = this.showWarnings;

function mdAriaService($$rAF, $log, $window, $interpolate, $document, showWarnings) {
return {
expect: expect,
expectAsync: expectAsync,
Expand Down
4 changes: 2 additions & 2 deletions src/core/services/gesture/gesture.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ MdGestureProvider.prototype = {
* $get is used to build an instance of $mdGesture
* @ngInject
*/
$get : function($$MdGestureHandler, $$rAF, $timeout) {
return new MdGesture($$MdGestureHandler, $$rAF, $timeout);
$get : function($injector) {
return $injector.instantiate(MdGesture);
}
};

Expand Down
4 changes: 4 additions & 0 deletions src/core/services/interaction/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ angular
* </hljs>
*
*/
/**
* @ngInject
*/
function MdInteractionService($timeout, $mdUtil, $document, $window) {
this.$timeout = $timeout;
this.$mdUtil = $mdUtil;
this.$window = $window;
this.$document = $document;

this.bodyElement = angular.element($document[0].body);
this.isBuffering = false;
Expand Down
5 changes: 3 additions & 2 deletions src/core/services/theming/theming.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ function generateAllThemes($injector, $mdTheming, $document) {
* If yes, then immediately disable all theme stylesheet generation and DOM injection
*/
var isDisabled = (
!$mdTheming.isDisabled || // tests tinker with $mdTheming
$mdTheming.isDisabled() ||
$document[0].querySelector('[md-themes-disabled]')
);
Expand All @@ -987,7 +988,7 @@ function generateAllThemes($injector, $mdTheming, $document) {
var themeCss = !isDisabled && $injector.has('$MD_THEME_CSS') ? $injector.get('$MD_THEME_CSS') : '';

// Append our custom registered styles to the theme stylesheet.
themeCss += $mdTheming.registeredStyles();
themeCss += $mdTheming.registeredStyles ? $mdTheming.registeredStyles() : '';

if ( !firstChild ) return;
if (themeCss.length === 0) return; // no rules, so no point in running this expensive task
Expand Down Expand Up @@ -1040,7 +1041,7 @@ function generateAllThemes($injector, $mdTheming, $document) {

angular.forEach($mdTheming.THEMES, function(theme) {
if (!GENERATED[theme.name] && !($mdTheming.defaultTheme() !== 'default' && theme.name === 'default')) {
generateTheme(theme, theme.name, $mdTheming.nonce());
generateTheme($document[0], theme, theme.name, $mdTheming.nonce());
}
});

Expand Down
9 changes: 6 additions & 3 deletions src/core/util/animation/animate.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
// Polyfill angular < 1.4 (provide $animateCss)
angular
.module('material.core')
.factory('$$mdAnimate', function($q, $timeout, $mdConstant, $animateCss){
.factory('$$mdAnimate', function($injector){

// Since $$mdAnimate is injected into $mdUtil... use a wrapper function
// to subsequently inject $mdUtil as an argument to the AnimateDomUtils

return function($mdUtil) {
return AnimateDomUtils( $mdUtil, $q, $timeout, $mdConstant, $animateCss);
return $injector.invoke(animateDomUtils, undefined, { $mdUtil: $mdUtil });
};
});

/**
* Factory function that requires special injections
*/
function AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss, $window) {
/**
* @ngInject
*/
function animateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss, $window) {
var self;
return self = {
/**
Expand Down

0 comments on commit 0857fdb

Please sign in to comment.