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

Commit

Permalink
test(slider): templateOptions.disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela committed Jan 12, 2016
1 parent 9f76f0e commit f6b5890
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/types/slider-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ describe('formlyMaterial - slider type', () => {
let $scope;
let form;
let element;
let elementScope;
const fieldConfig = {
key: 'testField',
type: 'slider',
templateOptions: {
label: 'test field',
disabled: true,
min: 1,
max: 5,
step: 0.5,
Expand All @@ -32,6 +34,7 @@ describe('formlyMaterial - slider type', () => {
form = $compile(testUtils.getFormTemplate())($scope);
$scope.$digest();
element = form.find('[ng-model]');
elementScope = element.scope();
}

//
Expand Down Expand Up @@ -66,9 +69,12 @@ describe('formlyMaterial - slider type', () => {
});

it('should support discrete option', () => {
const scope = angular.element(element).scope();

expect(element.attr('md-discrete')).toEqual(`options.templateOptions['discrete']`);
expect(scope.options.templateOptions.discrete).toBe(fieldConfig.templateOptions.discrete);
expect(elementScope.options.templateOptions.discrete).toBe(fieldConfig.templateOptions.discrete);
});

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 f6b5890

Please sign in to comment.