Skip to content

Commit 08d37c0

Browse files
committed
coverage (passive not supported in PhantomJS)
1 parent 1073035 commit 08d37c0

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

src/compiler/helpers.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* @flow */
22

3-
import { warn } from 'core/util/index'
43
import { parseFilters } from './parser/filter-parser'
54

65
export function baseWarn (msg: string) {
@@ -40,10 +39,15 @@ export function addHandler (
4039
name: string,
4140
value: string,
4241
modifiers: ?ASTModifiers,
43-
important: ?boolean
42+
important?: boolean,
43+
warn?: Function
4444
) {
4545
// warn prevent and passive modifier
46-
if (process.env.NODE_ENV !== 'production' && modifiers && modifiers.prevent && modifiers.passive) {
46+
/* istanbul ignore if */
47+
if (
48+
process.env.NODE_ENV !== 'production' && warn &&
49+
modifiers && modifiers.prevent && modifiers.passive
50+
) {
4751
warn(
4852
'passive and prevent can\'t be used together. ' +
4953
'Passive handler can\'t prevent default event.'
@@ -58,6 +62,7 @@ export function addHandler (
5862
delete modifiers.once
5963
name = '~' + name // mark the event as once
6064
}
65+
/* istanbul ignore if */
6166
if (modifiers && modifiers.passive) {
6267
delete modifiers.passive
6368
name = '&' + name // mark the event as passive

src/compiler/parser/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const modifierRE = /\.[^.]+/g
3131
const decodeHTMLCached = cached(decode)
3232

3333
// configurable state
34-
let warn
34+
export let warn
3535
let delimiters
3636
let transforms
3737
let preTransforms
@@ -478,7 +478,7 @@ function processAttrs (el) {
478478
}
479479
} else if (onRE.test(name)) { // v-on
480480
name = name.replace(onRE, '')
481-
addHandler(el, name, value, modifiers)
481+
addHandler(el, name, value, modifiers, false, warn)
482482
} else { // normal directives
483483
name = name.replace(dirRE, '')
484484
// parse arg

src/core/instance/inject.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export function initInjections (vm: Component) {
1717
const result = resolveInject(vm.$options.inject, vm)
1818
if (result) {
1919
Object.keys(result).forEach(key => {
20+
/* istanbul ignore else */
2021
if (process.env.NODE_ENV !== 'production') {
2122
defineReactive(vm, key, result[key], () => {
2223
warn(

src/core/util/env.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ if (inBrowser) {
2121
try {
2222
const opts = {}
2323
Object.defineProperty(opts, 'passive', ({
24-
get: function () { supportsPassive = true }
24+
get () {
25+
/* istanbul ignore next */
26+
supportsPassive = true
27+
}
2528
} : Object)) // https://github.com/facebook/flow/issues/285
2629
window.addEventListener('test-passive', null, opts)
2730
} catch (e) {}

0 commit comments

Comments
 (0)