@@ -259,36 +259,33 @@ describe('uiCodemirror', function() {
259259
260260 it ( 'when the IDE changes should update the model' , function ( ) {
261261 var element = $compile ( '<div ui-codemirror ng-model="foo"></div>' ) ( scope ) ;
262+ var ctrl = element . controller ( 'ngModel' ) ;
262263
263- expect ( element ) . toBeDefined ( ) ;
264- expect ( element . attr ( 'class' ) ) . toEqual (
265- 'ng-pristine ng-untouched ng-valid ng-scope'
266- ) ;
264+ expect ( ctrl . $pristine ) . toBe ( true ) ;
265+ expect ( ctrl . $valid ) . toBe ( true ) ;
267266
268267 var value = 'baz' ;
269268 codemirror . setValue ( value ) ;
269+ scope . $apply ( ) ;
270270 expect ( scope . foo ) . toBe ( value ) ;
271271
272- expect ( element . attr ( 'class' ) ) . toEqual (
273- 'ng-untouched ng-valid ng-scope ng-dirty ng-valid-parse'
274- ) ;
272+ expect ( ctrl . $valid ) . toBe ( true ) ;
273+ expect ( ctrl . $dirty ) . toBe ( true ) ;
275274
276275 } ) ;
277276
278277 it ( 'when the model changes should update the IDE' , function ( ) {
279278 var element = $compile ( '<div ui-codemirror ng-model="foo"></div>' ) ( scope ) ;
279+ var ctrl = element . controller ( 'ngModel' ) ;
280280
281- expect ( element ) . toBeDefined ( ) ;
282- expect ( element . attr ( 'class' ) ) . toEqual (
283- 'ng-pristine ng-untouched ng-valid ng-scope'
284- ) ;
281+ expect ( ctrl . $pristine ) . toBe ( true ) ;
282+ expect ( ctrl . $valid ) . toBe ( true ) ;
285283
286284 scope . $apply ( 'foo = "bar"' ) ;
287285 expect ( codemirror . getValue ( ) ) . toBe ( scope . foo ) ;
288286
289- expect ( element . attr ( 'class' ) ) . toEqual (
290- 'ng-pristine ng-untouched ng-valid ng-scope'
291- ) ;
287+ expect ( ctrl . $pristine ) . toBe ( true ) ;
288+ expect ( ctrl . $valid ) . toBe ( true ) ;
292289 } ) ;
293290
294291
0 commit comments