Skip to content
Myr

polyfills.js

This file

Path

__tests__/polyfills.js

86 lines · 1.9 KiB · JavaScript

Last changed by

fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2

History of this file

Take it

The walk stopped after 200 commits: lines older than fbae585 point at it.

fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2

line 1why, one step back
1const {assign, getOwnPropertyDescriptors} = Object

docs: fix video player scrolling on chrome, fixes #520Michel Weststratebefore adoptionfbae585

lines 2–4why, one step back
2const {ownKeys} = Reflect
3const SymbolConstructor = Symbol4

fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2

lines 5–6why, one step back
5const testSymbol = Symbol("test-symbol")
6

docs: fix video player scrolling on chrome, fixes #520Michel Weststratebefore adoptionfbae585

lines 7–9why, one step back
7Symbol = undefined
8Object.assign = undefined9Reflect.ownKeys = undefined

fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2

line 10why, one step back
10Object.getOwnPropertyDescriptors = undefined

docs: fix video player scrolling on chrome, fixes #520Michel Weststratebefore adoptionfbae585

lines 11–18why, one step back
11
12jest.resetModules()13const common = require("../src/internal")1415// Reset the globals to avoid unintended effects.16Symbol = SymbolConstructor17Object.assign = assign18Reflect.ownKeys = ownKeys

fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2

line 19why, one step back
19Object.getOwnPropertyDescriptors = getOwnPropertyDescriptors

docs: fix video player scrolling on chrome, fixes #520Michel Weststratebefore adoptionfbae585

lines 20–52why, one step back
20
21if (!global.USES_BUILD)22 describe("Symbol", () => {23 test("NOTHING", () => {24 const value = common.NOTHING25 expect(value).toBeTruthy()26 expect(typeof value).toBe("object")27 })28 test("DRAFTABLE", () => {29 const value = common.DRAFTABLE30 expect(typeof value).toBe("string")31 })32 test("DRAFT_STATE", () => {33 const value = common.DRAFT_STATE34 expect(typeof value).toBe("string")35 })36 })3738if (!global.USES_BUILD)39 describe("Reflect.ownKeys", () => {40 const {ownKeys} = common4142 // Symbol keys are always last.43 it("includes symbol keys", () => {44 const s = SymbolConstructor()45 const obj = {[s]: 1, b: 1}46 expect(ownKeys(obj)).toEqual(["b", s])47 })4849 it("includes non-enumerable keys", () => {50 const obj = {a: 1}51 Object.defineProperty(obj, "b", {value: 1})52 expect(ownKeys(obj)).toEqual(["a", "b"])

fix: `getOwnPropertyDescriptors` is not available in Internet Explorer and Hermes. Fixes #626Michel Weststratebefore adoptionc7a47e2

lines 53–80why, one step back
53 })
54 })5556if (!global.USES_BUILD)57 describe("Object.getOwnPropertyDescriptors", () => {58 const {getOwnPropertyDescriptors} = common5960 // Symbol keys are always last.61 it("gets symbolic and nonsymbolic properties", () => {62 expect(63 Object.getOwnPropertyDescriptors({64 x: 1,65 [testSymbol]: 266 })67 ).toEqual({68 x: {69 value: 1,70 enumerable: true,71 configurable: true,72 writable: true73 },74 [testSymbol]: {75 value: 2,76 enumerable: true,77 configurable: true,78 writable: true79 }80 })

docs: fix video player scrolling on chrome, fixes #520Michel Weststratebefore adoptionfbae585

lines 81–86why, one step back
81 })
82 })8384test("suppress jest warning", () => {85 expect(true).toBe(true)86})