async function testMarkdown(apiType: 'classic' | 'composition') {
const baseUrl = `file://${path.resolve(
__dirname,
- `../${apiType}/markdown.html`
+ `../${apiType}/markdown.html#test`
)}`
await page().goto(baseUrl)
await page().type('textarea', '\n## foo\n\n- bar\n- baz')
// assert the output is not updated yet because of debounce
expect(await html('#editor div')).toBe('<h1 id="hello">hello</h1>\n')
- await page().waitFor(500)
+ await page().waitFor(16)
expect(await html('#editor div')).toBe(
'<h1 id="hello">hello</h1>\n' +
'<h2 id="foo">foo</h2>\n' +
-<script src="https://unpkg.com/marked@0.3.6"></script>
-<script src="https://unpkg.com/lodash@4.16.0"></script>
+<script src="../../../../node_modules/marked/marked.min.js"></script>
+<script src="../../../../node_modules/lodash/lodash.min.js"></script>
<script src="../../dist/vue.global.js"></script>
<div id="editor">
</div>
<script>
+const delay = window.location.hash === '#test' ? 16 : 300
+
const App = {
data: {
input: '# hello'
methods: {
update: _.debounce(function (e) {
this.input = e.target.value
- }, 300)
+ }, delay)
}
}
<script src="../../dist/vue.global.js"></script>
-<link rel="stylesheet" href="https://unpkg.com/todomvc-app-css/index.css">
+<link rel="stylesheet" href="../../../../node_modules/todomvc-app-css/index.css">
<div id="app">
<section class="todoapp">
-<script src="https://unpkg.com/marked@0.3.6"></script>
-<script src="https://unpkg.com/lodash@4.16.0"></script>
+<script src="../../../../node_modules/marked/marked.min.js"></script>
+<script src="../../../../node_modules/lodash/lodash.min.js"></script>
<script src="../../dist/vue.global.js"></script>
<div id="editor">
</div>
<script>
+const delay = window.location.hash === '#test' ? 16 : 300
const { ref, computed } = Vue
const App = {
setup() {
const input = ref('# hello')
const output = computed(() => marked(input.value, { sanitize: true }))
- const update = _.debounce(e => { input.value = e.target.value }, 300)
+ const update = _.debounce(e => { input.value = e.target.value }, delay)
return {
input,
<script src="../../dist/vue.global.js"></script>
-<link rel="stylesheet" href="https://unpkg.com/todomvc-app-css/index.css">
+<link rel="stylesheet" href="../../../../node_modules/todomvc-app-css/index.css">
<div id="app">
<section class="todoapp">
-<script src="https://cdn.jsdelivr.net/lodash/4.3.0/lodash.min.js"></script>
+<script src="../../../../node_modules/lodash/lodash.min.js"></script>
<script src="../../dist/vue.global.js"></script>
<div id="app">
"dependencies": {
"@vue/compiler-dom": "3.0.0-alpha.0",
"@vue/runtime-dom": "3.0.0-alpha.0"
+ },
+ "devDependencies": {
+ "lodash": "^4.17.15",
+ "marked": "^0.7.0",
+ "todomvc-app-css": "^2.3.0"
}
}
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
-lodash@^4.13.1, lodash@^4.17.13, lodash@^4.17.4, lodash@~4.17.15:
+lodash@^4.13.1, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.4, lodash@~4.17.15:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
dependencies:
object-visit "^1.0.0"
+marked@^0.7.0:
+ version "0.7.0"
+ resolved "https://registry.yarnpkg.com/marked/-/marked-0.7.0.tgz#b64201f051d271b1edc10a04d1ae9b74bb8e5c0e"
+ integrity sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==
+
meow@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4"
regex-not "^1.0.2"
safe-regex "^1.1.0"
+todomvc-app-css@^2.3.0:
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/todomvc-app-css/-/todomvc-app-css-2.3.0.tgz#cc27f1686ab4c418eef4e790289cc124baca2546"
+ integrity sha512-RG8hxqoVn8Be3wxyuyHfOSAXiY1Z0N+PYQOe/jxzy3wpU1Obfwd1RF1i/fz/fR+MrYL+Q+BdrUt8SsXdtR7Oow==
+
token-stream@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-0.0.1.tgz#ceeefc717a76c4316f126d0b9dbaa55d7e7df01a"