get tests passing on all suacelab browsers

This commit is contained in:
Evan You 2016-06-13 17:51:22 -04:00
parent cec833a9e8
commit 000433c878
6 changed files with 29 additions and 19 deletions

View File

@ -43,6 +43,11 @@ var batches = [
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11'
},
sl_edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
platform: 'Windows 10'
}
},
// mobile
@ -66,6 +71,7 @@ module.exports = function (config) {
var batch = batches[process.argv[4] || 0]
config.set(Object.assign(base, {
singleRun: true,
browsers: Object.keys(batch),
customLaunchers: batch,
reporters: ['progress', 'saucelabs'],

View File

@ -14,16 +14,18 @@
"dev:test": "karma start build/karma.dev.config.js",
"dev:ssr": "webpack --watch --config build/webpack.ssr.dev.config.js",
"dev:compiler": "webpack --watch --config build/webpack.compiler.dev.config.js",
"test": "npm run lint && flow check && npm run test:cover && npm run test:unit && npm run test:e2e && npm run test:ssr",
"ci": "npm run lint && flow check && npm run test:cover && npm run test:ssr",
"build": "NODE_ENV=production node build/build.js",
"lint": "eslint src build test",
"flow": "flow check",
"build:ssr": "npm run build -- vue.common.js,vue-template-compiler,vue-server-renderer",
"ci": "npm run lint && flow check && npm run test:cover && npm run test:ssr",
"test": "npm run lint && flow check && npm run test:cover && npm run test:unit && npm run test:e2e && npm run test:ssr",
"test:unit": "NODE_ENV=development karma start build/karma.unit.config.js",
"test:cover": "NODE_ENV=development karma start build/karma.cover.config.js",
"test:e2e": "npm run build -- vue.js && node test/e2e/runner.js",
"build:ssr": "npm run build -- vue.common.js,vue-template-compiler,vue-server-renderer",
"test:ssr": "npm run build:ssr && NODE_ENV=development VUE_ENV=server jasmine JASMINE_CONFIG_PATH=test/ssr/jasmine.json",
"test:sauce": "npm run sauce -- 0 && npm run sauce -- 1 && npm run sauce -- 2",
"lint": "eslint src build test",
"flow": "flow check",
"sauce": "NODE_ENV=development karma start build/karma.sauce.config.js",
"bench:ssr": "npm run build:ssr && NODE_ENV=production VUE_ENV=server node benchmarks/ssr/renderToString.js && NODE_ENV=production VUE_ENV=server node benchmarks/ssr/renderToStream.js",
"release": "bash build/release.sh"
},
@ -68,6 +70,7 @@
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.0",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^1.0.0",
"karma-sourcemap-loader": "^0.3.0",
"karma-spec-reporter": "^0.0.26",
"karma-webpack": "^1.7.0",

View File

@ -13,7 +13,7 @@ export const inBrowser =
export const devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__
// UA sniffing for working around browser-specific quirks
const UA = inBrowser && window.navigator.userAgent.toLowerCase()
export const UA = inBrowser && window.navigator.userAgent.toLowerCase()
const isIos = UA && /(iphone|ipad|ipod|ios)/i.test(UA)
const iosVersionMatch = UA && isIos && UA.match(/os ([\d_]+)/)
const iosVersion = iosVersionMatch && iosVersionMatch[1].split('_')

View File

@ -83,11 +83,6 @@ export function isUnknownElement (tag: string): boolean {
el.constructor === window.HTMLElement
))
} else {
return (unknownElementCache[tag] = (
/HTMLUnknownElement/.test(el.toString()) &&
// Chrome returns unknown for several HTML5 elements.
// https://code.google.com/p/chromium/issues/detail?id=540526
!/^(data|time|rtc|rb)$/.test(tag)
))
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
}
}

View File

@ -1,4 +1,5 @@
import Vue from 'vue'
import { UA } from 'core/util/env'
describe('Options components', () => {
it('should accept plain object', () => {
@ -74,10 +75,15 @@ describe('Options components', () => {
expect('Do not use built-in or reserved HTML elements as component').toHaveBeenWarned()
})
it('warn non-existent', () => {
new Vue({
template: '<test></test>'
}).$mount()
expect('Unknown custom element: <test>').toHaveBeenWarned()
})
// the HTMLUnknownElement check doesn't work in Android 4.2
// but since it doesn't support custom elements nor will any dev use it
// as their primary debugging browser, it doesn't really matter.
if (!(UA && /android 4\.2/.test(UA))) {
it('warn non-existent', () => {
new Vue({
template: '<test></test>'
}).$mount()
expect('Unknown custom element: <test>').toHaveBeenWarned()
})
}
})

View File

@ -389,7 +389,7 @@ if (!isIE9) {
expect(vm.$el.children[0].className).toBe('test test-leave')
}).thenWaitFor(nextFrame).then(() => {
expect(vm.$el.children[0].className).toBe('test test-leave-active')
}).thenWaitFor(duration / 2).then(() => {
}).thenWaitFor(10).then(() => {
vm.ok = true
}).then(() => {
expect(spy).toHaveBeenCalled()