|
872 | 872 | })
|
873 | 873 | })
|
874 | 874 |
|
875 |
| - if ( |
876 |
| - ('fetch' in window && 'Request' in window) || |
877 |
| - ('XMLHttpRequest' in window && 'ProgressEvent' in window) |
878 |
| - ) { |
879 |
| - describe('Fetch', function () { |
880 |
| - it('Should fetch image URL as blob if meta option is true', function (done) { |
881 |
| - expect( |
882 |
| - loadImage( |
883 |
| - imageUrlJPEG, |
884 |
| - function (img, data) { |
885 |
| - expect(data).to.be.ok |
886 |
| - expect(data.imageHead).to.be.ok |
887 |
| - expect(data.exif).to.be.ok |
888 |
| - expect(data.exif.get('Orientation')).to.equal(6) |
889 |
| - expect(data.iptc).to.be.ok |
890 |
| - expect(data.iptc.get('ObjectName')).to.equal('objectname') |
891 |
| - done() |
892 |
| - }, |
893 |
| - { meta: true } |
894 |
| - ) |
895 |
| - ).to.be.ok |
896 |
| - }) |
| 875 | + describe('Fetch', function () { |
| 876 | + if ( |
| 877 | + !('fetch' in window && 'Request' in window) && |
| 878 | + !('XMLHttpRequest' in window && 'ProgressEvent' in window) |
| 879 | + ) { |
| 880 | + return |
| 881 | + } |
897 | 882 |
|
898 |
| - it('Should load image URL as img if meta option is false', function (done) { |
899 |
| - expect( |
900 |
| - loadImage(imageUrlJPEG, function (img, data) { |
901 |
| - expect(data.imageHead).to.be.undefined |
902 |
| - expect(data.exif).to.be.undefined |
903 |
| - expect(img.width).to.equal(2) |
904 |
| - expect(img.height).to.equal(1) |
| 883 | + it('Should fetch image URL as blob if meta option is true', function (done) { |
| 884 | + expect( |
| 885 | + loadImage( |
| 886 | + imageUrlJPEG, |
| 887 | + function (img, data) { |
| 888 | + expect(data).to.be.ok |
| 889 | + expect(data.imageHead).to.be.ok |
| 890 | + expect(data.exif).to.be.ok |
| 891 | + expect(data.exif.get('Orientation')).to.equal(6) |
| 892 | + expect(data.iptc).to.be.ok |
| 893 | + expect(data.iptc.get('ObjectName')).to.equal('objectname') |
905 | 894 | done()
|
906 |
| - }) |
907 |
| - ).to.be.ok |
908 |
| - }) |
| 895 | + }, |
| 896 | + { meta: true } |
| 897 | + ) |
| 898 | + ).to.be.ok |
909 | 899 | })
|
910 |
| - } |
| 900 | + |
| 901 | + it('Should load image URL as img if meta option is false', function (done) { |
| 902 | + expect( |
| 903 | + loadImage(imageUrlJPEG, function (img, data) { |
| 904 | + expect(data.imageHead).to.be.undefined |
| 905 | + expect(data.exif).to.be.undefined |
| 906 | + expect(img.width).to.equal(2) |
| 907 | + expect(img.height).to.equal(1) |
| 908 | + done() |
| 909 | + }) |
| 910 | + ).to.be.ok |
| 911 | + }) |
| 912 | + }) |
911 | 913 | })(this.chai.expect, this.loadImage)
|
0 commit comments