mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-26 07:18:09 +03:00
27 lines
447 B
Go
27 lines
447 B
Go
|
package key
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestBinding_Enabled(t *testing.T) {
|
||
|
binding := NewBinding(
|
||
|
WithKeys("k", "up"),
|
||
|
WithHelp("↑/k", "move up"),
|
||
|
)
|
||
|
if !binding.Enabled() {
|
||
|
t.Errorf("expected key to be Enabled")
|
||
|
}
|
||
|
|
||
|
binding.SetEnabled(false)
|
||
|
if binding.Enabled() {
|
||
|
t.Errorf("expected key not to be Enabled")
|
||
|
}
|
||
|
|
||
|
binding.SetEnabled(true)
|
||
|
binding.Unbind()
|
||
|
if binding.Enabled() {
|
||
|
t.Errorf("expected key not to be Enabled")
|
||
|
}
|
||
|
}
|