diff --git a/Tests/Tests/Interactive/CustomEditors.dcl b/Tests/Tests/Interactive/CustomEditors.dcl new file mode 100644 index 0000000000000000000000000000000000000000..436b9f1eaab1218537a351c72e63babaa4446abf --- /dev/null +++ b/Tests/Tests/Interactive/CustomEditors.dcl @@ -0,0 +1,7 @@ +definition module Tests.Interactive.CustomEditors +/** +* Tests for creating custom editors +*/ +import iTasks, TestFramework + +testCustomEditors :: TestSuite diff --git a/Tests/Tests/Interactive/CustomEditors.icl b/Tests/Tests/Interactive/CustomEditors.icl new file mode 100644 index 0000000000000000000000000000000000000000..0abfcbd73c166d343aafceb2809af9bcd1fa86bd --- /dev/null +++ b/Tests/Tests/Interactive/CustomEditors.icl @@ -0,0 +1,39 @@ +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 +