Skip to content

Instantly share code, notes, and snippets.

@tanepiper
Created February 7, 2013 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanepiper/62bd10125e8408def5cc to your computer and use it in GitHub Desktop.
Save tanepiper/62bd10125e8408def5cc to your computer and use it in GitHub Desktop.
'use strict';
invoicingApp.directive('currencySelect', function() {
return {
templateUrl: 'views/currency-select.html',
restrict: 'A',
replace: true
};
});
'use strict';
describe('Directive: currencySelect', function() {
beforeEach(module('invoicingApp'));
var element,
controller,
scope;
beforeEach(inject(function($rootScope, $controller, $compile) {
scope = $rootScope.$new();
scope.currencies = [{
name: '£ (GBP)',
display: '£'
}, {
name: '$ (US)',
display: '$'
}];
scope.selected_currency = scope.currencies[0];
element = angular.element('<div currency-select></div>');
element = $compile(element)(scope);
scope.$digest();
}));
it('should contain currency options', function() {
expect(element.get(0).text()).toBe('£ (GBP)');
});
});
hantomJS 1.8 Directive: currencySelect should contain currency options FAILED
Error: Unexpected request: GET views/currency-select.html
No more request expected
at $httpBackend (/Users/tanepiper/work/invoicing/test/vendor/angular-mocks.js:888)
at n (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:92)
at l (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:91)
at /Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:93
at V (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:46)
at A (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:44)
at t (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:38)
at w (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:37)
at /Users/tanepiper/work/invoicing/test/spec/directives/currencySelect.js:23
at d (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:27)
at workFn (/Users/tanepiper/work/invoicing/test/vendor/angular-mocks.js:1711)
TypeError: 'undefined' is not a function (evaluating 'element.get(0)')
at /Users/tanepiper/work/invoicing/test/spec/directives/currencySelect.js:28
Chrome 24.0 Directive: currencySelect should contain currency options FAILED
Error: Unexpected request: GET views/currency-select.html
No more request expected
at Error (<anonymous>)
at $httpBackend (/Users/tanepiper/work/invoicing/test/vendor/angular-mocks.js:887:9)
at n (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:92:433)
at l (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:91:156)
at Function.l.(anonymous function) [as get] (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:93:346)
at V (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:46:101)
at A (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:44:183)
at t (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:38:315)
at w (/Users/tanepiper/work/invoicing/app/scripts/vendor/angular.min.js:37:211)
at null.<anonymous> (/Users/tanepiper/work/invoicing/test/spec/directives/currencySelect.js:23:15)
Error: Declaration Location
at window.jasmine.window.inject.angular.mock.inject (/Users/tanepiper/work/invoicing/test/vendor/angular-mocks.js:1697:17)
at null.<anonymous> (/Users/tanepiper/work/invoicing/test/spec/directives/currencySelect.js:10:14)
at /Users/tanepiper/work/invoicing/test/spec/directives/currencySelect.js:3:1
TypeError: Object [[object HTMLDivElement]] has no method 'get'
at null.<anonymous> (/Users/tanepiper/work/invoicing/test/spec/directives/currencySelect.js:28:20)
Chrome 24.0: Executed 1 of 20 (1 FAILED) (skipped 19) (0.176 secs / 0.015 secs)
PhantomJS 1.8: Executed 20 of 20 (1 FAILED) (0.101 secs / 0.042 secs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment