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

Commit 7ee864a

Browse files
author
Kamil Kisiela
committed
test(datepicker): templateOptions.disabled
1 parent aec4e60 commit 7ee864a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/types/datepicker-spec.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ describe('formlyMaterial - datepicker type', () => {
1010
let $scope;
1111
let form;
1212
let element;
13+
let elementScope;
1314
const minDate = new Date(2015, 10, 19);
1415
const maxDate = new Date(2015, 11, 20);
1516
const filterDate = () => true;
@@ -27,6 +28,7 @@ describe('formlyMaterial - datepicker type', () => {
2728
minDate,
2829
maxDate,
2930
filterDate,
31+
disabled: true,
3032
label: 'test field',
3133
placeholder: 'Pick a date'
3234
}
@@ -35,6 +37,7 @@ describe('formlyMaterial - datepicker type', () => {
3537
form = $compile(testUtils.getFormTemplate())($scope);
3638
$scope.$digest();
3739
element = form.find('[ng-model]');
40+
elementScope = angular.element(element).scope();
3841
}
3942

4043
//
@@ -61,23 +64,22 @@ describe('formlyMaterial - datepicker type', () => {
6164
});
6265

6366
it('should have min date', () => {
64-
const scope = angular.element(element).scope();
65-
6667
expect(element.attr('md-min-date')).toBe(`options.templateOptions['minDate']`);
67-
expect(scope.options.templateOptions.minDate.toDateString()).toBe(minDate.toDateString());
68+
expect(elementScope.options.templateOptions.minDate.toDateString()).toBe(minDate.toDateString());
6869
});
6970

7071
it('should have max date', () => {
71-
const scope = angular.element(element).scope();
72-
7372
expect(element.attr('md-max-date')).toBe(`options.templateOptions['maxDate']`);
74-
expect(scope.options.templateOptions.maxDate.toDateString()).toBe(maxDate.toDateString());
73+
expect(elementScope.options.templateOptions.maxDate.toDateString()).toBe(maxDate.toDateString());
7574
});
7675

7776
it('should have date filter', () => {
78-
const scope = angular.element(element).scope();
79-
8077
expect(element.attr('md-date-filter')).toBe(`options.templateOptions['filterDate']`);
81-
expect(scope.options.templateOptions.filterDate).toBe(filterDate);
78+
expect(elementScope.options.templateOptions.filterDate).toBe(filterDate);
79+
});
80+
81+
it('should be disabled', () => {
82+
expect(element.attr('ng-disabled')).toBe(`options.templateOptions['disabled']`);
83+
expect(elementScope.options.templateOptions.disabled).toBe(true);
8284
});
8385
});

0 commit comments

Comments
 (0)