add isMobile service and tests
This commit is contained in:
parent
78493f9d91
commit
0347cb5bda
4 changed files with 57 additions and 24 deletions
|
|
@ -214,4 +214,18 @@ describe("Unit: Controllers", function() {
|
|||
|
||||
});
|
||||
|
||||
describe('Send Controller', function() {
|
||||
var sendCtrl;
|
||||
beforeEach(inject(function($controller, $rootScope) {
|
||||
scope = $rootScope.$new();
|
||||
sendCtrl = $controller('SendController', {
|
||||
$scope: scope,
|
||||
});
|
||||
}));
|
||||
|
||||
it('should have a SendController', function() {
|
||||
expect(scope.isMobile).not.to.equal(null);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -108,3 +108,19 @@ describe("Unit: Backup Service", function() {
|
|||
expectation.once();
|
||||
}));
|
||||
});
|
||||
|
||||
describe("Unit: isMobile Service", function() {
|
||||
beforeEach(angular.mock.module('copayApp.services'));
|
||||
it('should contain a isMobile service', inject(function(isMobile) {
|
||||
expect(isMobile).not.to.equal(null);
|
||||
}));
|
||||
it('should not detect mobile by default', inject(function(isMobile) {
|
||||
isMobile.any().should.equal(false);
|
||||
}));
|
||||
it('should detect mobile if user agent is Android', inject(function(isMobile) {
|
||||
navigator.__defineGetter__('userAgent', function(){
|
||||
return 'Android 2.2.3';
|
||||
});
|
||||
isMobile.any().should.equal(true);
|
||||
}));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue