|
|
@ -18,12 +18,12 @@ class EventTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun buttonClickHandled() = runTest { |
|
|
|
fun buttonClickHandled() = runTest { |
|
|
|
var handeled = false |
|
|
|
var handled = false |
|
|
|
|
|
|
|
|
|
|
|
composition { |
|
|
|
composition { |
|
|
|
Button( |
|
|
|
Button( |
|
|
|
{ |
|
|
|
{ |
|
|
|
onClick { handeled = true } |
|
|
|
onClick { handled = true } |
|
|
|
} |
|
|
|
} |
|
|
|
) {} |
|
|
|
) {} |
|
|
|
} |
|
|
|
} |
|
|
@ -33,18 +33,18 @@ class EventTests { |
|
|
|
val btn = root.firstChild as HTMLElement |
|
|
|
val btn = root.firstChild as HTMLElement |
|
|
|
btn.dispatchEvent(MouseEvent("click")) |
|
|
|
btn.dispatchEvent(MouseEvent("click")) |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(handeled) |
|
|
|
assertTrue(handled) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun checkboxInputHandled() = runTest { |
|
|
|
fun checkboxInputHandled() = runTest { |
|
|
|
var handeled = false |
|
|
|
var handled = false |
|
|
|
|
|
|
|
|
|
|
|
composition { |
|
|
|
composition { |
|
|
|
Input( |
|
|
|
Input( |
|
|
|
type = InputType.Checkbox, |
|
|
|
type = InputType.Checkbox, |
|
|
|
attrs = { |
|
|
|
attrs = { |
|
|
|
onInput { handeled = true } |
|
|
|
onInput { handled = true } |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -52,18 +52,18 @@ class EventTests { |
|
|
|
val checkbox = root.firstChild as HTMLInputElement |
|
|
|
val checkbox = root.firstChild as HTMLInputElement |
|
|
|
checkbox.dispatchEvent(Event("input")) |
|
|
|
checkbox.dispatchEvent(Event("input")) |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(handeled) |
|
|
|
assertTrue(handled) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun radioButtonInputHandled() = runTest { |
|
|
|
fun radioButtonInputHandled() = runTest { |
|
|
|
var handeled = false |
|
|
|
var handled = false |
|
|
|
|
|
|
|
|
|
|
|
composition { |
|
|
|
composition { |
|
|
|
Input( |
|
|
|
Input( |
|
|
|
type = InputType.Radio, |
|
|
|
type = InputType.Radio, |
|
|
|
attrs = { |
|
|
|
attrs = { |
|
|
|
onInput { handeled = true } |
|
|
|
onInput { handled = true } |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -72,17 +72,17 @@ class EventTests { |
|
|
|
radio.dispatchEvent(Event("input")) |
|
|
|
radio.dispatchEvent(Event("input")) |
|
|
|
assertEquals(false, radio.checked) |
|
|
|
assertEquals(false, radio.checked) |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(handeled) |
|
|
|
assertTrue(handled) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun textAreaInputHandled() = runTest { |
|
|
|
fun textAreaInputHandled() = runTest { |
|
|
|
var handeled = false |
|
|
|
var handled = false |
|
|
|
|
|
|
|
|
|
|
|
composition { |
|
|
|
composition { |
|
|
|
TextArea( |
|
|
|
TextArea( |
|
|
|
{ |
|
|
|
{ |
|
|
|
onInput { handeled = true } |
|
|
|
onInput { handled = true } |
|
|
|
}, |
|
|
|
}, |
|
|
|
value = "" |
|
|
|
value = "" |
|
|
|
) |
|
|
|
) |
|
|
@ -93,6 +93,6 @@ class EventTests { |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("", radio.value) |
|
|
|
assertEquals("", radio.value) |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(handeled) |
|
|
|
assertTrue(handled) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|