|
| 1 | +/** |
| 2 | + * The goal of this spec file is to test in Internet Explorer via Jasmin |
| 3 | + * tests.html file a few of the polyfills we know are used in the editor. |
| 4 | + * These are mostly coming via microbit-fs library. |
| 5 | + * |
| 6 | + * In the past the build pipeline has somehow failed to include some of the |
| 7 | + * polyfills (in one case the minifier has also affected this). So having a |
| 8 | + * few tests here as a sanity check. |
| 9 | + * |
| 10 | + * Useful links: |
| 11 | + * https://kangax.github.io/compat-table/es6/ |
| 12 | + * https://caniuse.com/?search=es6 |
| 13 | + */ |
| 14 | + |
| 15 | +describe("Check (some) ES6 features work.", function() { |
| 16 | + /* Currently not used in microbit-fs |
| 17 | + it("String.prototype.startsWith()", function() { |
| 18 | + expect('random string'.startsWith('random')).toBeTruthy(); |
| 19 | + }); |
| 20 | + */ |
| 21 | + it("String.prototype.endsWith()", function() { |
| 22 | + expect('random string'.endsWith('string')).toBeTruthy(); |
| 23 | + }); |
| 24 | + |
| 25 | + it("String.prototype.includes()", function() { |
| 26 | + expect('random string'.includes('m s')).toBeTruthy(); |
| 27 | + }); |
| 28 | + |
| 29 | + it("isNaN()", function() { |
| 30 | + expect(isNaN('100F')).toBeTruthy(); |
| 31 | + }); |
| 32 | + /* Currently not used in microbit-fs |
| 33 | + it("Number.parseInt()", function() { |
| 34 | + expect(Number.parseInt(' 0xF', 16)).toEqual(15); |
| 35 | + }); |
| 36 | + */ |
| 37 | + it("Array.prototype.fill()", function() { |
| 38 | + var array1 = [1, 2, 3, 4]; |
| 39 | + array1.fill(0, 2, 4) |
| 40 | + expect(array1).toEqual([1, 2, 0, 0]); |
| 41 | + }); |
| 42 | + /* Currently not used in microbit-fs |
| 43 | + it("Array.prototype.find()", function() { |
| 44 | + var array1 = [5, 12, 8, 130, 44]; |
| 45 | + var found = array1.find(function(element) { |
| 46 | + return element > 10 |
| 47 | + }); |
| 48 | + expect(found).toEqual(12); |
| 49 | + }); |
| 50 | + */ |
| 51 | + /* Currently not used in microbit-fs |
| 52 | + it("Array.prototype.findIndex()", function() { |
| 53 | + var array1 = [5, 12, 8, 130, 44]; |
| 54 | + var isLargeNumber = array1.findIndex(function(element) { |
| 55 | + return element > 13 |
| 56 | + }); |
| 57 | + expect(isLargeNumber).toEqual(3); |
| 58 | + }); |
| 59 | + */ |
| 60 | +}); |
0 commit comments