File tree Expand file tree Collapse file tree 3 files changed +44
-2
lines changed Expand file tree Collapse file tree 3 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -92,4 +92,16 @@ suite('components tab', () => {
92
92
cy . get ( '.instance .self .attr-title' ) . contains ( 'key' )
93
93
cy . get ( '.instance .self .attr-value' ) . contains ( '1' )
94
94
} )
95
+
96
+ it ( 'should display injected props' , ( ) => {
97
+ cy . get ( '.left .search input' ) . clear ( ) . type ( 'Mine' )
98
+ cy . get ( '.instance' ) . eq ( 1 ) . click ( )
99
+ cy . get ( '.right .data-wrapper' ) . then ( el => {
100
+ expect ( el . text ( ) ) . to . contain ( 'injected' )
101
+ expect ( el . text ( ) ) . to . contain ( 'answer:42' )
102
+ expect ( el . text ( ) ) . to . contain ( 'foo:"bar"' )
103
+ expect ( el . text ( ) ) . to . contain ( 'noop:ƒ noop(a, b, c)' )
104
+ } )
105
+ cy . get ( '.left .search input' ) . clear ( )
106
+ } )
95
107
} )
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
3
Other {{ id }}
4
- <mine ></ mine >
4
+ <mine / >
5
5
</div >
6
6
</template >
7
7
@@ -18,8 +18,13 @@ const computedPropMixin = {
18
18
19
19
export default {
20
20
name: ' other-with-mine' ,
21
- props: [' id' ],
22
21
mixins: [computedPropMixin],
22
+ provide: {
23
+ foo: ' bar' ,
24
+ noop : (a , b , c ) => {},
25
+ answer: 42
26
+ },
27
+ props: [' id' ],
23
28
data () {
24
29
const a = { c : function () {} }
25
30
a .a = a
@@ -32,6 +37,7 @@ export default {
32
37
},
33
38
components: {
34
39
mine: {
40
+ inject: [' foo' , ' noop' , ' answer' ],
35
41
render : h => h (' div' , { class: ' mine' }, ' mine' ),
36
42
data () {
37
43
return {
Original file line number Diff line number Diff line change @@ -378,6 +378,7 @@ function getInstanceState (instance) {
378
378
return processProps ( instance ) . concat (
379
379
processState ( instance ) ,
380
380
processComputed ( instance ) ,
381
+ processInjected ( instance ) ,
381
382
processRouteContext ( instance ) ,
382
383
processVuexGetters ( instance ) ,
383
384
processFirebaseBindings ( instance ) ,
@@ -563,6 +564,29 @@ function processComputed (instance) {
563
564
return computed
564
565
}
565
566
567
+ /**
568
+ * Process Vuex getters.
569
+ *
570
+ * @param {Vue } instance
571
+ * @return {Array }
572
+ */
573
+
574
+ function processInjected ( instance ) {
575
+ const injected = instance . $options . inject
576
+
577
+ if ( injected ) {
578
+ return Object . keys ( injected ) . map ( key => {
579
+ return {
580
+ key,
581
+ type : 'injected' ,
582
+ value : instance [ key ]
583
+ }
584
+ } )
585
+ } else {
586
+ return [ ]
587
+ }
588
+ }
589
+
566
590
/**
567
591
* Process possible vue-router $route context
568
592
*
You can’t perform that action at this time.
0 commit comments