Skip to content

Commit 08f0a8b

Browse files
committed
test case
1 parent 29f265d commit 08f0a8b

File tree

13 files changed

+633
-60
lines changed

13 files changed

+633
-60
lines changed

dist/vue.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue.runtime.common.js

+3
Original file line numberDiff line numberDiff line change
@@ -3283,6 +3283,9 @@ function resolveInject (inject, vm) {
32833283
}
32843284
source = source.$parent;
32853285
}
3286+
if (process.env.NODE_ENV !== 'production' && !hasOwn(result, key)) {
3287+
warn(("Injection \"" + key + "\" not found"), vm);
3288+
}
32863289
}
32873290
return result
32883291
}

examples/bug/index.html

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Vue example</title>
6+
<link rel="stylesheet" href="style.css">
7+
<script src="../../dist/vue.js"></script>
8+
</head>
9+
<body>
10+
11+
<div id="app"/>
12+
13+
<script>
14+
new Vue({
15+
el: '#app',
16+
data: "test",
17+
<!-- data: { -->
18+
<!-- slotNames: ["slot1", "slot2"] -->
19+
<!-- }, -->
20+
template: `
21+
<div>hello</div>
22+
`,
23+
<!-- watch: () => "wrong", -->
24+
watch: {
25+
slotNames: function (slotNames) {
26+
console.log(slotNames)
27+
}
28+
},
29+
components: {
30+
test: {
31+
template: `
32+
<div ref="test">
33+
<slot name="slot1" msg="hello"></slot>
34+
<slot name="slot2" msg="world"></slot>
35+
</div>
36+
`
37+
}
38+
}
39+
})
40+
</script>
41+
42+
</body>
43+
</html>
44+
45+
46+
47+
<!-- <test ref="test"> -->
48+
<!-- <template scope="props"> -->
49+
<!-- <template name="slot1" scope="props"> -->
50+
<!-- <template name="slot1"> -->
51+
<!-- <span></span> -->
52+
<!-- </template> -->
53+
<!-- </test> -->
54+
55+
56+
57+
<!-- <div> -->
58+
<!-- <slot :msg="msg"></slot> -->
59+
<!-- <slot msg="hello">hello-inner</slot> -->
60+
<!-- <slot :msg="msg" name="slot1">hello-inner</slot> -->
61+
<!-- <slot :msg="msg" name="slot1"></slot> -->
62+
<!-- <slot>hello-inner</slot> -->
63+
<!-- <slot msg="hello" name="slot1">hello-inner</slot> -->
64+
<!-- <slot msg="hello" name="slot1">hello-inner</slot> -->
65+
<!-- <slot msg="world" name="slot2">worl-inner</slot> -->
66+
<!-- </div> -->
67+
68+
<!-- <div> -->
69+
<!-- <slot>hello-inner</slot> -->
70+
<!-- </div> -->
71+
72+
<!-- <div> -->
73+
<!-- <slot msg="hello"></slot> -->
74+
<!-- </div> -->
75+
76+
77+
78+
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
<!-- Vue.component('parent', { -->
90+
<!-- template: ` -->
91+
<!-- <div> -->
92+
<!-- <child> -->
93+
<!-- <1!-- named and scoped --1> -->
94+
<!-- <1!-- <template v-for="item in slotNames" :slot="item" scope="props">{{ props.text }}</template> --1> -->
95+
<!-- <1!-- <template slot="slot1" scope="props">{{ props.text }}</template> --1> -->
96+
<!-- <1!-- <template slot="slot2" scope="props">{{ props.text }}</template> --1> -->
97+
98+
<!-- <1!-- just named --1> -->
99+
<!-- <1!-- <template v-for="item in slotNames" :slot="item"></template> --1> -->
100+
<!-- <slot name="slot1"></slot> -->
101+
<!-- <slot name="slot2"></slot> -->
102+
<!-- </child> -->
103+
<!-- </div> -->
104+
<!-- `, -->
105+
<!-- data: function () { -->
106+
<!-- return { -->
107+
<!-- slotNames: ["slot1", "slot2"] -->
108+
<!-- } -->
109+
<!-- } -->
110+
<!-- }); -->
111+
112+
<!-- Vue.component('child', { -->
113+
<!-- template: ` -->
114+
<!-- <div> -->
115+
<!-- <1!-- <slot name="slot1" text="1"></slot> --1> -->
116+
<!-- <1!-- <slot name="slot2" text="2"></slot> --1> -->
117+
<!-- <1!-- <slot name="slot1">1</slot> --1> -->
118+
<!-- <1!-- <slot name="slot2">2</slot> --1> -->
119+
<!-- <slot name="slot1" text="1">1</slot> -->
120+
<!-- <slot name="slot2" text="2">2</slot> -->
121+
<!-- </div> -->
122+
<!-- ` -->
123+
<!-- }); -->

examples/bug/style.css

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
html, body, #editor {
2+
margin: 0;
3+
height: 100%;
4+
font-family: 'Helvetica Neue', Arial, sans-serif;
5+
color: #333;
6+
}
7+
8+
textarea, #editor div {
9+
display: inline-block;
10+
width: 49%;
11+
height: 100%;
12+
vertical-align: top;
13+
-webkit-box-sizing: border-box;
14+
-moz-box-sizing: border-box;
15+
box-sizing: border-box;
16+
padding: 0 20px;
17+
}
18+
19+
textarea {
20+
border: none;
21+
border-right: 1px solid #ccc;
22+
resize: none;
23+
outline: none;
24+
background-color: #f6f6f6;
25+
font-size: 14px;
26+
font-family: 'Monaco', courier, monospace;
27+
padding: 20px;
28+
}
29+
30+
code {
31+
color: #f66;
32+
}

examples/bug2/index.html

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Vue example</title>
6+
<link rel="stylesheet" href="style.css">
7+
<script src="../../dist/vue.js"></script>
8+
</head>
9+
<body>
10+
11+
<div id="app"/>
12+
13+
<script>
14+
15+
var test = {
16+
created: function () {
17+
this.hello()
18+
},
19+
methods: {
20+
hello: function () {
21+
console.log('hello from mixin!')
22+
}
23+
}
24+
}
25+
26+
const injectedComp = {
27+
inject: ['foo', 'bar'],
28+
render () {},
29+
created () {
30+
console.log(this.foo);
31+
injected = [this.foo, this.bar]
32+
}
33+
};
34+
35+
new Vue({
36+
el: '#app',
37+
template: `<child/>`,
38+
provide: {
39+
foo: 1,
40+
bar: false
41+
},
42+
components: {
43+
44+
child: {
45+
template: `<injected-comp/>`,
46+
components: {
47+
injectedComp
48+
}
49+
}
50+
51+
<!-- child: { -->
52+
<!-- template: ` -->
53+
<!-- <div> -->
54+
<!-- foo: {{foo}} -->
55+
<!-- </div> -->
56+
<!-- `, -->
57+
<!-- inject: ['foo', 'bar'], -->
58+
<!-- render () {}, -->
59+
<!-- created () { -->
60+
<!-- injected = [this.foo, this.bar] -->
61+
<!-- } -->
62+
<!-- } -->
63+
64+
}
65+
})
66+
67+
<!-- new Vue({ -->
68+
<!-- el: '#app', -->
69+
<!-- mixins: [test], -->
70+
<!-- provide: { foo: 'bar' }, -->
71+
<!-- data: { -->
72+
<!-- foo: 'bar' -->
73+
<!-- }, -->
74+
<!-- template: ` -->
75+
<!-- <div> -->
76+
<!-- <test></test> -->
77+
<!-- <span :v-bind="hello()"></span> -->
78+
<!-- <span :v-bind="foo"></span> -->
79+
<!-- </div> -->
80+
<!-- `, -->
81+
<!-- components: { -->
82+
<!-- test: { -->
83+
<!-- inject: [foo], -->
84+
<!-- template: ` -->
85+
<!-- <div ref="test"> -->
86+
<!-- {{ foo }} -->
87+
<!-- <slot name="slot1" msg="hello"></slot> -->
88+
<!-- <slot name="slot2" msg="world"></slot> -->
89+
<!-- </div> -->
90+
<!-- ` -->
91+
<!-- } -->
92+
<!-- } -->
93+
<!-- }) -->
94+
</script>
95+
96+
</body>
97+
</html>
98+
99+
100+
101+
<!-- <test ref="test"> -->
102+
<!-- <template scope="props"> -->
103+
<!-- <template name="slot1" scope="props"> -->
104+
<!-- <template name="slot1"> -->
105+
<!-- <span></span> -->
106+
<!-- </template> -->
107+
<!-- </test> -->
108+
109+
110+
111+
<!-- <div> -->
112+
<!-- <slot :msg="msg"></slot> -->
113+
<!-- <slot msg="hello">hello-inner</slot> -->
114+
<!-- <slot :msg="msg" name="slot1">hello-inner</slot> -->
115+
<!-- <slot :msg="msg" name="slot1"></slot> -->
116+
<!-- <slot>hello-inner</slot> -->
117+
<!-- <slot msg="hello" name="slot1">hello-inner</slot> -->
118+
<!-- <slot msg="hello" name="slot1">hello-inner</slot> -->
119+
<!-- <slot msg="world" name="slot2">worl-inner</slot> -->
120+
<!-- </div> -->
121+
122+
<!-- <div> -->
123+
<!-- <slot>hello-inner</slot> -->
124+
<!-- </div> -->
125+
126+
<!-- <div> -->
127+
<!-- <slot msg="hello"></slot> -->
128+
<!-- </div> -->
129+
130+
131+
132+
133+
134+
135+
136+
137+
138+
139+
140+
141+
142+
143+
<!-- Vue.component('parent', { -->
144+
<!-- template: ` -->
145+
<!-- <div> -->
146+
<!-- <child> -->
147+
<!-- <1!-- named and scoped --1> -->
148+
<!-- <1!-- <template v-for="item in slotNames" :slot="item" scope="props">{{ props.text }}</template> --1> -->
149+
<!-- <1!-- <template slot="slot1" scope="props">{{ props.text }}</template> --1> -->
150+
<!-- <1!-- <template slot="slot2" scope="props">{{ props.text }}</template> --1> -->
151+
152+
<!-- <1!-- just named --1> -->
153+
<!-- <1!-- <template v-for="item in slotNames" :slot="item"></template> --1> -->
154+
<!-- <slot name="slot1"></slot> -->
155+
<!-- <slot name="slot2"></slot> -->
156+
<!-- </child> -->
157+
<!-- </div> -->
158+
<!-- `, -->
159+
<!-- data: function () { -->
160+
<!-- return { -->
161+
<!-- slotNames: ["slot1", "slot2"] -->
162+
<!-- } -->
163+
<!-- } -->
164+
<!-- }); -->
165+
166+
<!-- Vue.component('child', { -->
167+
<!-- template: ` -->
168+
<!-- <div> -->
169+
<!-- <1!-- <slot name="slot1" text="1"></slot> --1> -->
170+
<!-- <1!-- <slot name="slot2" text="2"></slot> --1> -->
171+
<!-- <1!-- <slot name="slot1">1</slot> --1> -->
172+
<!-- <1!-- <slot name="slot2">2</slot> --1> -->
173+
<!-- <slot name="slot1" text="1">1</slot> -->
174+
<!-- <slot name="slot2" text="2">2</slot> -->
175+
<!-- </div> -->
176+
<!-- ` -->
177+
<!-- }); -->

examples/bug2/style.css

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
html, body, #editor {
2+
margin: 0;
3+
height: 100%;
4+
font-family: 'Helvetica Neue', Arial, sans-serif;
5+
color: #333;
6+
}
7+
8+
textarea, #editor div {
9+
display: inline-block;
10+
width: 49%;
11+
height: 100%;
12+
vertical-align: top;
13+
-webkit-box-sizing: border-box;
14+
-moz-box-sizing: border-box;
15+
box-sizing: border-box;
16+
padding: 0 20px;
17+
}
18+
19+
textarea {
20+
border: none;
21+
border-right: 1px solid #ccc;
22+
resize: none;
23+
outline: none;
24+
background-color: #f6f6f6;
25+
font-size: 14px;
26+
font-family: 'Monaco', courier, monospace;
27+
padding: 20px;
28+
}
29+
30+
code {
31+
color: #f66;
32+
}

0 commit comments

Comments
 (0)