change param to optional param
alexfernandessd authored 4 years ago
James committed 4 years ago
2 | 2 |
// TextInputSubtype Accepts email, number, tel, or url. In some form factors, optimized input is provided for this subtype.
|
3 | 3 |
type TextInputSubtype string
|
4 | 4 |
|
5 | |
// TextInputOption hndle to optional inputs
|
6 | |
type TextInputOption func(*TextInputOption)
|
|
5 |
// TextInputOption handle to extra inputs options.
|
|
6 |
type TextInputOption func(*TextInputElement)
|
7 | 7 |
|
8 | 8 |
const (
|
9 | 9 |
// InputSubtypeEmail email keyboard
|
|
39 | 39 |
}
|
40 | 40 |
|
41 | 41 |
for _, opt := range options {
|
42 | |
opt(&t)
|
|
42 |
opt(t)
|
43 | 43 |
}
|
44 | 44 |
|
45 | 45 |
return t
|
9 | 9 |
name := "internalName"
|
10 | 10 |
label := "Human Readable"
|
11 | 11 |
value := "Pre filled text"
|
12 | |
optional := true
|
13 | |
textInput := NewTextInput(name, label, value, optional)
|
|
12 |
textInput := NewTextInput(name, label, value)
|
14 | 13 |
assert.Equal(t, InputTypeText, textInput.Type)
|
15 | 14 |
assert.Equal(t, name, textInput.Name)
|
16 | 15 |
assert.Equal(t, label, textInput.Label)
|
17 | 16 |
assert.Equal(t, value, textInput.Value)
|
18 | |
assert.Equal(t, optional, textInput.Optional)
|
19 | 17 |
}
|
20 | 18 |
|
21 | 19 |
func TestNewTextAreaInput(t *testing.T) {
|