mirror of
https://github.com/wahyd4/BarcodeScanner.git
synced 2026-08-09 04:55:57 +10:00
[spec] Fixed spec
This commit is contained in:
@@ -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 a scan function", function() {
|
||||
expect(window.plugins.barcodeScanner.scan).toBeDefined();
|
||||
expect(typeof window.plugins.barcodeScanner.scan == 'function').toBe(true);
|
||||
});
|
||||
|
||||
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 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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user