test(e2e): avoid relying on CDN + reduce debounce delay
This commit is contained in:
@@ -7,7 +7,7 @@ describe('e2e: markdown', () => {
|
||||
async function testMarkdown(apiType: 'classic' | 'composition') {
|
||||
const baseUrl = `file://${path.resolve(
|
||||
__dirname,
|
||||
`../${apiType}/markdown.html`
|
||||
`../${apiType}/markdown.html#test`
|
||||
)}`
|
||||
|
||||
await page().goto(baseUrl)
|
||||
@@ -18,7 +18,7 @@ describe('e2e: markdown', () => {
|
||||
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' +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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">
|
||||
@@ -8,6 +8,8 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const delay = window.location.hash === '#test' ? 16 : 300
|
||||
|
||||
const App = {
|
||||
data: {
|
||||
input: '# hello'
|
||||
@@ -20,7 +22,7 @@ const App = {
|
||||
methods: {
|
||||
update: _.debounce(function (e) {
|
||||
this.input = e.target.value
|
||||
}, 300)
|
||||
}, delay)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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">
|
||||
@@ -8,13 +8,14 @@
|
||||
</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,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<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">
|
||||
|
||||
Reference in New Issue
Block a user