File tree 3 files changed +46
-1
lines changed
3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,32 @@ describe('quickstart-angular App', () => {
9
9
10
10
it ( 'should display welcome message' , ( ) => {
11
11
page . navigateTo ( ) ;
12
- expect ( page . getParagraphText ( ) ) . toEqual ( 'Welcome to app!' ) ;
12
+ expect ( page . getParagraphText ( ) ) . toEqual ( 'Welcome to ui-router!' ) ;
13
+ } ) ;
14
+
15
+ it ( 'should render 3 links' , ( ) => {
16
+ page . navigateTo ( ) ;
17
+ expect ( page . getLinks ( ) . count ( ) ) . toEqual ( 3 ) ;
18
+ } ) ;
19
+
20
+ it ( 'should render Hello state' , ( ) => {
21
+ page . navigateTo ( ) ;
22
+ page . getLink ( 'Hello' ) . click ( ) ;
23
+ expect ( page . getUrl ( ) ) . toEqual ( '/hello' ) ;
24
+ expect ( page . getViewContent ( ) ) . toEqual ( 'hello works!' ) ;
25
+ } ) ;
26
+
27
+ it ( 'should render World state' , ( ) => {
28
+ page . navigateTo ( ) ;
29
+ page . getLink ( 'World' ) . click ( ) ;
30
+ expect ( page . getUrl ( ) ) . toEqual ( '/world' ) ;
31
+ expect ( page . getViewContent ( ) ) . toEqual ( 'world works!' ) ;
32
+ } ) ;
33
+
34
+ it ( 'should render World.nest state' , ( ) => {
35
+ page . navigateTo ( ) ;
36
+ page . getLink ( 'World.nest' ) . click ( ) ;
37
+ expect ( page . getUrl ( ) ) . toEqual ( '/world/nest' ) ;
38
+ expect ( page . getViewContent ( ) ) . toEqual ( 'world works!\nnest works!' ) ;
13
39
} ) ;
14
40
} ) ;
Original file line number Diff line number Diff line change @@ -5,7 +5,23 @@ export class AppPage {
5
5
return browser . get ( '/' ) ;
6
6
}
7
7
8
+ getUrl ( ) {
9
+ return browser . getCurrentUrl ( ) . then ( result => result . replace ( / ^ h t t p : ..[ ^ / ] * / , '' ) ) ;
10
+ }
11
+
8
12
getParagraphText ( ) {
9
13
return element ( by . css ( 'app-root h1' ) ) . getText ( ) ;
10
14
}
15
+
16
+ getLinks ( ) {
17
+ return element . all ( by . tagName ( 'a' ) ) ;
18
+ }
19
+
20
+ getLink ( text : string ) {
21
+ return element . all ( by . linkText ( text ) ) ;
22
+ }
23
+
24
+ getViewContent ( ) {
25
+ return element . all ( by . tagName ( 'ui-view' ) ) . first ( ) . getText ( ) ;
26
+ }
11
27
}
Original file line number Diff line number Diff line change 1
1
< a uiSref ="hello " uiSrefActive ="active "> Hello</ a >
2
2
< a uiSref ="world " uiSrefActive ="active "> World</ a >
3
3
< a uiSref ="world.nest " uiSrefActive ="active "> World.nest</ a >
4
+
5
+ < h1 > Welcome to ui-router!</ h1 >
6
+
4
7
< ui-view > </ ui-view >
You can’t perform that action at this time.
0 commit comments