Skip to content
This repository was archived by the owner on Jan 22, 2018. It is now read-only.

Commit 178ac76

Browse files
author
Kamil Kisiela
committed
test(switch): templateOptions.disabled
1 parent f6b5890 commit 178ac76

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/types/switch-spec.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe('formlyMaterial - switch type', () => {
99
let $rootScope;
1010
let $scope;
1111
let element;
12+
let elementScope;
1213
let field;
1314

1415
//
@@ -21,14 +22,16 @@ describe('formlyMaterial - switch type', () => {
2122
key: 'testField',
2223
type: 'switch',
2324
templateOptions: {
24-
label: 'test field'
25+
label: 'test field',
26+
disabled: true
2527
}
2628
}, options)];
2729

2830
const form = $compile(testUtils.getFormTemplate())($scope);
2931

3032
$scope.$digest();
3133
element = form.find('[ng-model]');
34+
elementScope = element.scope();
3235
field = $scope.fields[0];
3336
}
3437

@@ -54,4 +57,9 @@ describe('formlyMaterial - switch type', () => {
5457
it('should have label', () => {
5558
expect(element.find('.md-label > span').html()).toContain(field.templateOptions.label);
5659
});
60+
61+
it('should be able to be disabled', () => {
62+
expect(element.attr('ng-disabled')).toBe(`options.templateOptions['disabled']`);
63+
expect(elementScope.options.templateOptions.disabled).toBe(true);
64+
});
5765
});

0 commit comments

Comments
 (0)