Neues Initialrelease mit IonicMaterial

This commit is contained in:
Carsten Hilmer
2016-08-22 12:55:52 +02:00
parent 30a5df79aa
commit 45e482b14d
1249 changed files with 305225 additions and 68794 deletions

View File

@@ -0,0 +1,78 @@
describe('ngCordovaMocks', function() {
beforeEach(function() {
module('ngCordovaMocks');
});
describe('cordovaCamera', function () {
var $rootScope = null;
var $cordovaCamera = null;
var cameraOptions = {};
beforeEach(inject(function (_$cordovaCamera_, _$rootScope_) {
$cordovaCamera = _$cordovaCamera_;
$rootScope = _$rootScope_;
}));
it('should get picture', function (done) {
$cordovaCamera.getPicture(cameraOptions)
.then(
function() { expect(true).toBe(true); },
function() { expect(false).toBe(true); }
)
.finally(function() { done(); })
;
$rootScope.$digest();
});
it('should throw an error while getting the picture.', function(done) {
$cordovaCamera.throwsError = true;
$cordovaCamera.imageData = '';
$cordovaCamera.getPicture(cameraOptions)
.then(
function() { expect(true).toBe(false); },
function() { expect(true).toBe(true); }
)
.finally(function() { done(); })
;
$rootScope.$digest();
});
it('should return the url of the picture.', function(done) {
var expected = 'file:///mnt/sdcard/dummy/myImage.jpeg';
$cordovaCamera.throwsError = false;
$cordovaCamera.imageData = expected;
$cordovaCamera.getPicture(cameraOptions)
.then(
function(imageData) {
expect(imageData).toEqual(expected);
},
function() {
expected(false).toBe(true);
} )
.finally(
function() {
done(); });
$rootScope.$digest();
});
it('should return an empty string as imageData.', function(done) {
var expected = '';
$cordovaCamera.throwsError = false;
$cordovaCamera.getPicture(cameraOptions)
.then(
function(imageData) {
expect(imageData).toMatch('');
},
function() {
expect(false).toBe(true);
})
.finally(function() { done(); });
$rootScope.$digest();
});
});
})