-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b52a5c
commit 1bfe1d9
Showing
6 changed files
with
139 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import '../src/index.js' | ||
// The polyfill is dependent on the animationstart event for polyfilling animations declared in css. | ||
// This causes timing issues when running some wpt tests that wait for animation.ready. | ||
// The tests might run before the animations are polyfilled, making them flaky. | ||
|
||
// The following code delays a selected list of tests until animations are polyfilled. | ||
|
||
// List of names of tests that should wait for animationstart | ||
const cssAnimationTests = [ | ||
'View timeline attached to SVG graphics element' | ||
] | ||
|
||
const animationsStarted = new Promise((resolve) => { | ||
window.addEventListener('animationstart', () => { | ||
setTimeout(() => resolve(), 1); | ||
}); | ||
}) | ||
|
||
// Proxy the promise_test function | ||
let nativePromiseTest; | ||
Reflect.defineProperty(window, 'promise_test', { | ||
get() { | ||
return (func, name, properties) => { | ||
if (cssAnimationTests.includes(name)) { | ||
// Wait for animationstart before starting tests | ||
return nativePromiseTest.call(null, async (...args) => { | ||
await animationsStarted; | ||
return func.call(null, ...args); | ||
}, name, properties); | ||
} else { | ||
nativePromiseTest.call(null, func, name, properties); | ||
} | ||
}; | ||
}, set(v) { | ||
nativePromiseTest = v; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
import { resolve } from 'path' | ||
import { defineConfig } from 'vite' | ||
|
||
export default defineConfig({ | ||
build: { | ||
sourcemap: true, | ||
lib: { | ||
// Could also be a dictionary or array of multiple entry points | ||
entry: resolve(__dirname, 'src/index.js'), | ||
name: 'ScrollTimeline', | ||
// the proper extensions will be added | ||
fileName: (format, entryAlias) => `scroll-timeline${format=='iife'?'':'-' + format}.js`, | ||
formats: ['iife'], | ||
}, | ||
minify: 'terser', | ||
terserOptions: { | ||
keep_classnames: /^((View|Scroll)Timeline)|CSS.*$/ | ||
}, | ||
rollupOptions: { | ||
output: { | ||
// Provide global variables to use in the UMD build | ||
// for externalized deps | ||
globals: { | ||
}, | ||
export default defineConfig(({ mode }) => { | ||
return { | ||
build: { | ||
sourcemap: true, | ||
lib: { | ||
// Could also be a dictionary or array of multiple entry points | ||
entry: resolve(__dirname, mode === 'test' ? 'test/entry.js' : 'src/index.js'), | ||
name: 'ScrollTimeline', | ||
// the proper extensions will be added | ||
fileName: (format, entryAlias) => `scroll-timeline${format == 'iife' ? '' : '-' + format}.js`, | ||
formats: ['iife'], | ||
}, | ||
} | ||
}, | ||
minify: 'terser', | ||
terserOptions: { | ||
keep_classnames: /^((View|Scroll)Timeline)|CSS.*$/ | ||
}, | ||
rollupOptions: { | ||
output: { | ||
// Provide global variables to use in the UMD build | ||
// for externalized deps | ||
globals: {}, | ||
}, | ||
} | ||
}, | ||
}; | ||
}) |