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

Commit

Permalink
test(switch): templateOptions.disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela committed Jan 12, 2016
1 parent f6b5890 commit 178ac76
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/types/switch-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('formlyMaterial - switch type', () => {
let $rootScope;
let $scope;
let element;
let elementScope;
let field;

//
Expand All @@ -21,14 +22,16 @@ describe('formlyMaterial - switch type', () => {
key: 'testField',
type: 'switch',
templateOptions: {
label: 'test field'
label: 'test field',
disabled: true
}
}, options)];

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

$scope.$digest();
element = form.find('[ng-model]');
elementScope = element.scope();
field = $scope.fields[0];
}

Expand All @@ -54,4 +57,9 @@ describe('formlyMaterial - switch type', () => {
it('should have label', () => {
expect(element.find('.md-label > span').html()).toContain(field.templateOptions.label);
});

it('should be able to be disabled', () => {
expect(element.attr('ng-disabled')).toBe(`options.templateOptions['disabled']`);
expect(elementScope.options.templateOptions.disabled).toBe(true);
});
});

0 comments on commit 178ac76

Please sign in to comment.