@@ -5,6 +5,7 @@ const assert = chai.assert;
5
5
6
6
const WinnerIsYou = Vue . extend ( WinnerIsYouComponent ) ;
7
7
8
+
8
9
describe ( "WinnerIsYou.vue" , ( ) => {
9
10
beforeEach ( ( ) => {
10
11
let main = document . getElementById ( "app" ) ;
@@ -15,17 +16,21 @@ describe("WinnerIsYou.vue", () => {
15
16
main . id = "app" ;
16
17
document . body . appendChild ( main ) ;
17
18
}
19
+
20
+ const mountPoint = document . createElement ( "div" ) ;
21
+ mountPoint . id = "mountMe" ;
22
+ document . getElementById ( "app" ) . appendChild ( mountPoint ) ;
18
23
} ) ;
19
24
20
25
it ( "Renders nothing when showText undefined" , ( ) => {
21
- let vm = new WinnerIsYou ( ) . $mount ( "#app " ) as IWinnerIsYou ;
22
-
26
+ let vm = new WinnerIsYou ( ) . $mount ( "#mountMe " ) as IWinnerIsYou ;
27
+
23
28
assert . equal ( vm . text , "" ) ;
24
29
assert . equal ( vm . $el . textContent , "" ) ;
25
30
} ) ;
26
-
31
+
27
32
it ( "Updates correctly" , ( done ) => {
28
- let vm = new WinnerIsYou ( ) . $mount ( "#app " ) as IWinnerIsYou ;
33
+ let vm = new WinnerIsYou ( ) . $mount ( "#mountMe " ) as IWinnerIsYou ;
29
34
assert . equal ( vm . text , "" ) ;
30
35
assert . equal ( vm . $el . textContent , "" ) ;
31
36
vm . showText = "This page is intentionally styled poorly" ;
@@ -38,9 +43,9 @@ describe("WinnerIsYou.vue", () => {
38
43
done ( ) ;
39
44
} ) ;
40
45
} ) ;
41
-
46
+
42
47
it ( "Captializes correctly" , ( done ) => {
43
- let vm = new WinnerIsYou ( ) . $mount ( "#app " ) as IWinnerIsYou ;
48
+ let vm = new WinnerIsYou ( ) . $mount ( "#mountMe " ) as IWinnerIsYou ;
44
49
assert . equal ( vm . text , "" ) ;
45
50
assert . equal ( vm . $el . textContent , "" ) ;
46
51
vm . showText = "This page is intentionally styled poorly" ;
@@ -53,7 +58,7 @@ describe("WinnerIsYou.vue", () => {
53
58
assert . equal ( vm . $el . textContent ,
54
59
"ALTERNATIVE TEXT" . toUpperCase ( ) ) ;
55
60
vm . doStuff ( ) ;
56
-
61
+
57
62
Vue . nextTick ( ( ) => {
58
63
assert . equal ( vm . showAlternate , false ) ;
59
64
assert . equal ( vm . text , "This page is intentionally styled poorly" . toUpperCase ( ) ) ;
0 commit comments