@@ -41,7 +41,6 @@ describe("DSL", function() {
41
41
describe ( 'repeater' , function ( ) {
42
42
43
43
var repeater = angular . scenario . dsl . repeater ;
44
-
45
44
it ( 'should count' , function ( ) {
46
45
var future = repeater ( '.repeater-row' ) . count ( ) ;
47
46
expect ( future . name ) . toEqual ( "repeater '.repeater-row' count" ) ;
@@ -79,4 +78,40 @@ describe("DSL", function() {
79
78
expect ( future . value [ 1 ] . boundTo ( 'game' ) ) . toEqual ( 'Uncharted 2' ) ;
80
79
} ) ;
81
80
} ) ;
81
+
82
+ describe ( 'element' , function ( ) {
83
+ var element = angular . scenario . dsl . element ;
84
+ var html ;
85
+ beforeEach ( function ( ) {
86
+ html = '<div class="container">' +
87
+ '<table class="reports-detail">' +
88
+ '<span class="desc">Description : ' +
89
+ '<span ng:bind="report.description">Details...</span>' +
90
+ '</span>' +
91
+ '<span>Date created: ' +
92
+ '<span ng:bind="report.creationDate">01/01/01</span>' +
93
+ '</span>' +
94
+ '</table>' +
95
+ '</div>' ;
96
+ } ) ;
97
+ it ( 'should find elements on the page and provide jquery api' , function ( ) {
98
+ var future = element ( '.reports-detail' ) ;
99
+ expect ( future . name ) . toEqual ( "Find element '.reports-detail'" ) ;
100
+ executeFuture ( future , html , function ( value ) { future . fulfill ( value ) ; } ) ;
101
+ expect ( future . fulfilled ) . toBeTruthy ( ) ;
102
+ expect ( future . value . text ( ) ) .
103
+ toEqual ( 'Description : Details...Date created: 01/01/01' ) ;
104
+ expect ( future . value . find ( '.desc' ) . text ( ) ) .
105
+ toEqual ( 'Description : Details...' ) ;
106
+ } ) ;
107
+ it ( 'should know how to find ng:bind elements on page' , function ( ) {
108
+ var future = element ( '.reports-detail' ) ;
109
+ expect ( future . name ) . toEqual ( "Find element '.reports-detail'" ) ;
110
+ executeFuture ( future , html , function ( value ) { future . fulfill ( value ) ; } ) ;
111
+ expect ( future . fulfilled ) . toBeTruthy ( ) ;
112
+ expect ( future . value . boundTo ( 'report.description' ) ) . toEqual ( 'Details...' ) ;
113
+ expect ( future . value . boundTo ( 'report.creationDate' ) ) . toEqual ( '01/01/01' ) ;
114
+ expect ( future . value . boundTo ( 'doesnotexist' ) ) . not . toBeDefined ( ) ;
115
+ } ) ;
116
+ } ) ;
82
117
} ) ;
0 commit comments