File tree Expand file tree Collapse file tree 4 files changed +8
-14
lines changed Expand file tree Collapse file tree 4 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,15 @@ class default_1 extends Controller {
30
30
button . classList . add ( ...this . buttonClassesValue ) ;
31
31
button . setAttribute ( 'tabindex' , '-1' ) ;
32
32
button . addEventListener ( 'click' , this . toggle . bind ( this ) ) ;
33
- button . innerHTML = this . visibleIcon + ' ' + this . visibleLabelValue ;
33
+ button . innerHTML = ` ${ this . visibleIcon } ${ this . visibleLabelValue } ` ;
34
34
return button ;
35
35
}
36
36
toggle ( event ) {
37
37
this . isDisplayed = ! this . isDisplayed ;
38
38
const toggleButtonElement = event . currentTarget ;
39
39
toggleButtonElement . innerHTML = this . isDisplayed
40
- ? this . hiddenIcon + ' ' + this . hiddenLabelValue
41
- : this . visibleIcon + ' ' + this . visibleLabelValue ;
40
+ ? ` ${ this . hiddenIcon } ${ this . hiddenLabelValue } `
41
+ : ` ${ this . visibleIcon } ${ this . visibleLabelValue } ` ;
42
42
this . element . setAttribute ( 'type' , this . isDisplayed ? 'text' : 'password' ) ;
43
43
this . dispatchEvent ( this . isDisplayed ? 'show' : 'hide' , { element : this . element , button : toggleButtonElement } ) ;
44
44
}
Original file line number Diff line number Diff line change 7
7
* file that was distributed with this source code.
8
8
*/
9
9
10
- 'use strict' ;
11
-
12
10
import { Controller } from '@hotwired/stimulus' ;
13
11
14
12
export default class extends Controller < HTMLInputElement > {
@@ -57,7 +55,7 @@ export default class extends Controller<HTMLInputElement> {
57
55
button . classList . add ( ...this . buttonClassesValue ) ;
58
56
button . setAttribute ( 'tabindex' , '-1' ) ;
59
57
button . addEventListener ( 'click' , this . toggle . bind ( this ) ) ;
60
- button . innerHTML = this . visibleIcon + ' ' + this . visibleLabelValue ;
58
+ button . innerHTML = ` ${ this . visibleIcon } ${ this . visibleLabelValue } ` ;
61
59
62
60
return button ;
63
61
}
@@ -69,8 +67,8 @@ export default class extends Controller<HTMLInputElement> {
69
67
this . isDisplayed = ! this . isDisplayed ;
70
68
const toggleButtonElement : HTMLButtonElement = event . currentTarget ;
71
69
toggleButtonElement . innerHTML = this . isDisplayed
72
- ? this . hiddenIcon + ' ' + this . hiddenLabelValue
73
- : this . visibleIcon + ' ' + this . visibleLabelValue ;
70
+ ? ` ${ this . hiddenIcon } ${ this . hiddenLabelValue } `
71
+ : ` ${ this . visibleIcon } ${ this . visibleLabelValue } ` ;
74
72
this . element . setAttribute ( 'type' , this . isDisplayed ? 'text' : 'password' ) ;
75
73
this . dispatchEvent ( this . isDisplayed ? 'show' : 'hide' , { element : this . element , button : toggleButtonElement } ) ;
76
74
}
Original file line number Diff line number Diff line change 7
7
* file that was distributed with this source code.
8
8
*/
9
9
10
- 'use strict' ;
11
-
12
10
import { Application , Controller } from '@hotwired/stimulus' ;
13
11
import { getByTestId , waitFor , getByText } from '@testing-library/dom' ;
14
12
import user from '@testing-library/user-event' ;
@@ -31,7 +29,7 @@ const startStimulus = () => {
31
29
}
32
30
33
31
describe ( 'TogglePasswordController' , ( ) => {
34
- let container ;
32
+ let container : HTMLElement ;
35
33
36
34
beforeEach ( ( ) => {
37
35
container = mountDOM ( `
Original file line number Diff line number Diff line change 2
2
"name" : " symfony/ux-toggle-password" ,
3
3
"type" : " symfony-bundle" ,
4
4
"description" : " Toggle visibility of password inputs for Symfony Forms" ,
5
- "keywords" : [
6
- " symfony-ux"
7
- ],
5
+ "keywords" : [" symfony-ux" ],
8
6
"homepage" : " https://symfony.com" ,
9
7
"license" : " MIT" ,
10
8
"authors" : [
You can’t perform that action at this time.
0 commit comments