Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 8cc7e03

Browse files
committed
test: add rendererOptions tests
1 parent 76fc37d commit 8cc7e03

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

test/ace.spec.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ describe('uiAce', function () {
8080
_ace.setOption = jasmine
8181
.createSpy('ace.setOption')
8282
.and.callThrough();
83+
_ace.renderer.setOption = jasmine
84+
.createSpy('ace.setOption')
85+
.and.callThrough();
8386
return _ace;
8487
});
8588
});
@@ -88,16 +91,23 @@ describe('uiAce', function () {
8891
window.ace.edit = aceEditFunction;
8992
});
9093

91-
it('Given advanced option is null if not defined.', function () {
94+
it('should not trigger ace#setOption.', function () {
9295
$compile('<div ui-ace>')(scope);
9396
expect(_ace.setOption.calls.count()).toEqual(0);
9497
});
9598

96-
it('given advanced options are properly defined.', function () {
97-
$compile('<div ui-ace=\'{ advanced: { enableSnippets: true } }\'>')(scope);
99+
it('should trigger ace#setOption with "advanced" options.', function () {
100+
$compile('<div ui-ace=\'{ advanced: { enableSnippets: true } }\'>')(scope);
98101
expect(_ace.setOption.calls.count()).toEqual(1);
99102
expect(_ace.setOption).toHaveBeenCalledWith('enableSnippets', true);
100103
});
104+
105+
it('should trigger renderer#setOption with "rendererOptions" options.', function () {
106+
$compile('<div ui-ace=\'{ rendererOptions: { maxLines: 42 } }\'>')(scope);
107+
expect(_ace.renderer.setOption.calls.count()).toEqual(2);
108+
expect(_ace.renderer.setOption).toHaveBeenCalledWith('showGutter', false);
109+
expect(_ace.renderer.setOption).toHaveBeenCalledWith('maxLines', 42);
110+
});
101111
});
102112

103113
describe('basic behavior', function () {

0 commit comments

Comments
 (0)