File tree 4 files changed +29
-1
lines changed
4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 13
13
?required =" {{ required }} "
14
14
.value =" {{ value }} "
15
15
placeholder =" {{ placeholder }} "
16
+ maxlength =" {{ maxlength }} "
16
17
role =" {{ accInfo.input.role }} "
17
18
aria-owns =" {{ accInfo.input.ariaOwns }} "
18
19
aria-invalid =" {{ accInfo.input.ariaInvalid }} "
Original file line number Diff line number Diff line change 9
9
isSpace ,
10
10
isEnter ,
11
11
} from "@ui5/webcomponents-base/dist/events/PseudoEvents.js" ;
12
+ import Integer from "@ui5/webcomponents-base/dist/types/Integer.js" ;
12
13
import { fetchI18nBundle , getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js" ;
13
14
// import Icon from "./Icon.js";
14
15
import InputType from "./types/InputType.js" ;
@@ -210,6 +211,17 @@ const metadata = {
210
211
type : Boolean ,
211
212
} ,
212
213
214
+ /**
215
+ * Sets the maximum number of characters available in the input field.
216
+ *
217
+ * @type {Integer }
218
+ * @since 1.0.0-rc.5
219
+ * @public
220
+ */
221
+ maxlength : {
222
+ type : Integer ,
223
+ } ,
224
+
213
225
/**
214
226
* @private
215
227
*/
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ <h3> Input type 'Email'</h3>
77
77
< ui5-input id ="myInput4 " style ="width:100% " type ="Email " name ="my-input-email "> </ ui5-input >
78
78
79
79
< h3 > Input type 'Tel'</ h3 >
80
- < ui5-input id ="myInput5 " style ="width:100% " type ="Tel " name ="my-input-tel "> </ ui5-input >
80
+ < ui5-input id ="myInput5 " maxlength =" 10 " style ="width:100% " type ="Tel " name ="my-input-tel "> </ ui5-input >
81
81
82
82
< h3 > Input type 'URL'</ h3 >
83
83
< ui5-input id ="myInput6 " style ="width:100% " type ="URL "> </ ui5-input >
Original file line number Diff line number Diff line change @@ -129,4 +129,19 @@ describe("Input general interaction", () => {
129
129
assert.strictEqual(innerInput.getValue(), "", "Inner's property value should be empty");
130
130
});
131
131
*/
132
+
133
+ it ( "Input's maxlength property is set correctly" , ( ) => {
134
+ const input5 = $ ( "#myInput5" ) ;
135
+ const inputShadowRef = $ ( "#myInput5" ) . shadow$ ( "input" ) ;
136
+
137
+ inputShadowRef . click ( ) ;
138
+
139
+ for ( let i = 0 ; i < 15 ; i ++ ) {
140
+ inputShadowRef . keys ( "c" ) ;
141
+ }
142
+
143
+ assert . strictEqual ( inputShadowRef . getProperty ( "value" ) . length , 10 , "Input's value should not exceed 10 characters." ) ;
144
+ assert . ok ( input5 . getProperty ( "maxlength" ) , "Input's maxlength property should be applied." ) ;
145
+ assert . strictEqual ( inputShadowRef . getAttribute ( "maxlength" ) , "10" , "Input's maxlength attribute should be applied." ) ;
146
+ } ) ;
132
147
} ) ;
You can’t perform that action at this time.
0 commit comments