]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test(e2e): avoid relying on CDN + reduce debounce delay
authorEvan You <yyx990803@gmail.com>
Wed, 11 Dec 2019 15:37:03 +0000 (10:37 -0500)
committerEvan You <yyx990803@gmail.com>
Wed, 11 Dec 2019 15:37:03 +0000 (10:37 -0500)
packages/vue/examples/__tests__/markdown.spec.ts
packages/vue/examples/classic/markdown.html
packages/vue/examples/classic/todomvc.html
packages/vue/examples/composition/markdown.html
packages/vue/examples/composition/todomvc.html
packages/vue/examples/transition/list.html
packages/vue/package.json
yarn.lock

index 196f72002d023af2f5363a72ff170e218ab2c507..6b248cb5486eb0622578d6dc24b588f76a31af22 100644 (file)
@@ -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' +
index c30c9655f631b1883c0e0ad7109d2598262cd156..afca4ef07ed356edc797746732432b2710ed781a 100644 (file)
@@ -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)
   }
 }
 
index 9e6501e0a5dfdaf60eb67af104a67fec2d2e9a1f..adfe47e2618eb72ba93ce41dcbac4e4c07a2eea2 100644 (file)
@@ -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">
index 9a75d45ee33287a5aaaea46ff3401432ee43277e..1a29219023d3ab9f8d707878ea7cb2054e1f6b63 100644 (file)
@@ -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,
index 7a9de2813230d2e3fd581b71b50f47c6388e79ad..83a339d7f5f78e72b4772ca0ce4fb8cd82721f5f 100644 (file)
@@ -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">
index 6236a8ac889456c667692de62f57c53bee8fd235..5535d6566cb39bdc94a4e6671612ada78bb42d63 100644 (file)
@@ -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">
index a06ab849723df31eba0bdf67db60a6cac95b9beb..f17ccfd6be789a7d0333823557ae4c9442fccf49 100644 (file)
   "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"
   }
 }
index 34b63168d586d25a00d35cb1e5d2e0bc66018f27..11475711821cb214b8df66c961316759e5b3b6cc 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -3430,7 +3430,7 @@ lodash.sortby@^4.7.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==
@@ -3568,6 +3568,11 @@ map-visit@^1.0.0:
   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"
@@ -5298,6 +5303,11 @@ to-regex@^3.0.1, to-regex@^3.0.2:
     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"