Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
[spec] Fixed spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Willoughby committed May 30, 2013
1 parent 657ec45 commit 33b2e91
Showing 1 changed file with 11 additions and 40 deletions.
51 changes: 11 additions & 40 deletions spec/barcodescanner.tests.js
Expand Up @@ -19,52 +19,23 @@
*
*/

describe('Camera (navigator.camera)', function () {
describe('Plugin object (window.plugins)', function () {
it("should exist", function() {
expect(navigator.camera).toBeDefined();
expect(window.plugins).toBeDefined();
});

it("should contain a getPicture function", function() {
expect(navigator.camera.getPicture).toBeDefined();
expect(typeof navigator.camera.getPicture == 'function').toBe(true);
it("should contain a barcodeScanner object", function() {
expect(window.plugins.barcodeScanner).toBeDefined();
expect(typeof window.plugins.barcodeScanner == 'object').toBe(true);
});
});

describe('Camera Constants (window.Camera + navigator.camera)', function () {
it("window.Camera should exist", function() {
expect(window.Camera).toBeDefined();
});

it("should contain three DestinationType constants", function() {
expect(Camera.DestinationType.DATA_URL).toBe(0);
expect(Camera.DestinationType.FILE_URI).toBe(1);
expect(Camera.DestinationType.NATIVE_URI).toBe(2);
expect(navigator.camera.DestinationType.DATA_URL).toBe(0);
expect(navigator.camera.DestinationType.FILE_URI).toBe(1);
expect(navigator.camera.DestinationType.NATIVE_URI).toBe(2);
it("should contain a scan function", function() {
expect(window.plugins.barcodeScanner.scan).toBeDefined();
expect(typeof window.plugins.barcodeScanner.scan == 'function').toBe(true);
});

it("should contain two EncodingType constants", function() {
expect(Camera.EncodingType.JPEG).toBe(0);
expect(Camera.EncodingType.PNG).toBe(1);
expect(navigator.camera.EncodingType.JPEG).toBe(0);
expect(navigator.camera.EncodingType.PNG).toBe(1);
});

it("should contain three MediaType constants", function() {
expect(Camera.MediaType.PICTURE).toBe(0);
expect(Camera.MediaType.VIDEO).toBe(1);
expect(Camera.MediaType.ALLMEDIA).toBe(2);
expect(navigator.camera.MediaType.PICTURE).toBe(0);
expect(navigator.camera.MediaType.VIDEO).toBe(1);
expect(navigator.camera.MediaType.ALLMEDIA).toBe(2);
});
it("should contain three PictureSourceType constants", function() {
expect(Camera.PictureSourceType.PHOTOLIBRARY).toBe(0);
expect(Camera.PictureSourceType.CAMERA).toBe(1);
expect(Camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2);
expect(navigator.camera.PictureSourceType.PHOTOLIBRARY).toBe(0);
expect(navigator.camera.PictureSourceType.CAMERA).toBe(1);
expect(navigator.camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2);
it("should contain an encode function", function() {
expect(window.plugins.barcodeScanner.encode).toBeDefined();
expect(typeof window.plugins.barcodeScanner.encode == 'function').toBe(true);
});
});

0 comments on commit 33b2e91

Please sign in to comment.