Skip to content
This repository was archived by the owner on May 25, 2019. It is now read-only.

Commit 8f7f377

Browse files
committed
chore(test): test the dotted property. Merge and close #28.
1 parent 35e3fc5 commit 8f7f377

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/codemirror.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,23 @@ describe('uiCodemirror', function () {
262262
scope.$digest();
263263
expect(codemirror.getOption('readOnly')).toBeFalsy();
264264
});
265+
266+
it('should watch the options (object property)', function () {
267+
spyOn(scope, '$watch').andCallThrough();
268+
269+
scope.cm = {};
270+
scope.cm.option = { readOnly: true };
271+
$compile('<div ui-codemirror="cm.option"></div>')(scope);
272+
273+
expect(scope.$watch.callCount).toEqual(1); // the uiCodemirror option
274+
expect(scope.$watch).toHaveBeenCalledWith('cm.option', jasmine.any(Function), true);
275+
expect(codemirror.getOption('readOnly')).toBeTruthy();
276+
277+
scope.cm.option.readOnly = false;
278+
scope.$digest();
279+
expect(codemirror.getOption('readOnly')).toBeFalsy();
280+
});
281+
265282
});
266283

267284
it('when the model is an object or an array should throw an error', function () {

0 commit comments

Comments
 (0)