This repository was archived by the owner on Jan 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +69
-1
lines changed Expand file tree Collapse file tree 2 files changed +69
-1
lines changed Original file line number Diff line number Diff line change 1
- import './md-theme-manipulator-spec' ;
1
+ import './md-theme-manipulator-spec' ;
2
+ import './md-no-autogrow-spec' ;
Original file line number Diff line number Diff line change
1
+ import testUtils from './../test-utils' ;
2
+
3
+ describe ( "formlyMaterial - textarea no autogrow manipulator" , ( ) => {
4
+
5
+ //
6
+ // vars
7
+ //
8
+ let formlyConfig ;
9
+ let $compile ;
10
+ let $rootScope ;
11
+ let $scope ;
12
+ let element ;
13
+ let field ;
14
+
15
+ //
16
+ // helpers
17
+ //
18
+
19
+ function compile ( options ) {
20
+ $scope = $rootScope . $new ( ) ;
21
+ $scope . fields = [ angular . merge ( { } , {
22
+ key : 'testField' ,
23
+ type : 'textarea' ,
24
+ templateOptions : {
25
+ label : 'test field' ,
26
+ grow : false
27
+ }
28
+ } , options ) ] ;
29
+
30
+ let form = $compile ( testUtils . getFormTemplate ( ) ) ( $scope ) ;
31
+
32
+ $scope . $digest ( ) ;
33
+ element = form . find ( '[ng-model]' ) ;
34
+ field = $scope . fields [ 0 ] ;
35
+ }
36
+
37
+ //
38
+ // tests
39
+ //
40
+
41
+ beforeEach ( ( ) => {
42
+ window . module ( 'formlyMaterial' ) ;
43
+
44
+ inject ( ( _$compile_ , _$rootScope_ , _formlyConfig_ ) => {
45
+ $compile = _$compile_ ;
46
+ $rootScope = _$rootScope_ ;
47
+ formlyConfig = _formlyConfig_ ;
48
+ } ) ;
49
+
50
+ compile ( ) ;
51
+ } ) ;
52
+
53
+ it ( 'should be able to add md-no-autogrow attribute when grow equals false' , ( ) => {
54
+ compile ( ) ;
55
+ expect ( element . attr ( 'md-no-autogrow' ) ) . toBeDefined ( ) ;
56
+ } ) ;
57
+
58
+ it ( "should be able to skip md-no-autogrow" , ( ) => {
59
+ compile ( {
60
+ extras : {
61
+ skipNgModelAttrsManipulator : true
62
+ }
63
+ } ) ;
64
+ expect ( element . attr ( 'md-no-autogrow' ) ) . toBeUndefined ( ) ;
65
+ } ) ;
66
+
67
+ } ) ;
You can’t perform that action at this time.
0 commit comments