Commit 8d105ac0 authored by Bas Lijnse's avatar Bas Lijnse

Added some missing tests

parent fff82f69
definition module Tests.Interactive.CustomEditors
/**
* Tests for creating custom editors
*/
import iTasks, TestFramework
testCustomEditors :: TestSuite
implementation module Tests.Interactive.CustomEditors
import iTasks, TestFramework
import iTasks.UI.Definition, iTasks.UI.Editor.Builtin, iTasks.UI.Editor.Combinators
import qualified Data.Map as DM
testCustomEditors :: TestSuite
testCustomEditors = testsuite "Custom editors" "These tests check if customization of editors works"
[testColoredTextField
,testLabeledTextField
,testCombinedTextFields
,testMixedCombinedTextFields
]
testColoredTextField = itest "Colored text field" "Check if the textfield is pink" "You should be able to edit" tut
where
tut :: Task String
tut = testEditor (withAttributes (styleAttr "background-color: pink") (textField 'DM'.newMap)) "Hello world" Update
testLabeledTextField = itest "Labeled text field" "Check if the textfield has label foo" "You should be able to edit" tut
where
tut :: Task String
tut = testEditor (withLabel "Foo" (textField 'DM'.newMap)) "Hello world" Update
testCombinedTextFields = itest "Combined text fields" "Check if both text fields work" "You should be able to edit" tut
where
tut :: Task (String,String)
tut = testEditor (composeEditors UIContainer (textField 'DM'.newMap) (textField 'DM'.newMap)) ("Hello","world") Update
testMixedCombinedTextFields = itest "Mixed combined text fields" "Check if both text fields work" "You should be able to edit" tut
where
tut :: Task (String,String)
tut = testEditor editor ("Hello","world") Update
editor = composeEditors UIContainer username password
username = pink (withLabel "Username" (textField 'DM'.newMap))
password = pink (withLabel "Password" (passwordField 'DM'.newMap))
pink e = withAttributes (styleAttr "background-color: pink") e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment