{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecursiveDo #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module Potato.Flow.Deprecated.Controller.Manipulator.TextAreaSpec ( spec ) where import Relude hiding (empty, fromList) import Test.Hspec import Test.Hspec.Contrib.HUnit (fromHUnitTest) import Test.HUnit import Potato.Flow import Potato.Flow.Common import qualified Data.Map as Map checkSTextAreaTextAt :: Text -> XY -> PChar -> EverythingPredicate checkSTextAreaTextAt label k c = firstSuperOwlPredicate (Just label) $ \sowl -> case hasOwlItem_toSElt_hack sowl of SEltTextArea (STextArea _ tm _) -> Map.lookup k tm == Just c _ -> False -- TODO DELTEE This isn't even testingh TextArea test_basic :: Test test_basic = constructTest "basic" emptyOwlPFState bs expected where bs = [ -- TODO text area tool??? EWCLabel "create " , EWCTool Tool_Text , EWCMouse (LMouseData (V2 10 10) False MouseButton_Left [] False) , EWCMouse (LMouseData (V2 20 20) False MouseButton_Left [] False) , EWCMouse (LMouseData (V2 20 20) True MouseButton_Left [] False) , EWCLabel "modify " , EWCKeyboard (KeyboardData (KeyboardKey_Char 'p') []) , EWCKeyboard (KeyboardData (KeyboardKey_Char 'o') []) , EWCKeyboard (KeyboardData (KeyboardKey_Char 'o') []) --, EWCKeyboard (KeyboardData (KeyboardKey_Char 'p') []) ] expected = [ LabelCheck "create " , EqPredicate goatState_selectedTool Tool_Text , checkHandlerNameAndState handlerName_box True , checkHandlerNameAndState handlerName_box True , Combine [ firstSuperOwlPredicate (Just "") $ \sowl -> case hasOwlItem_toSElt_hack sowl of SEltBox (SBox lbox _ _ _ _) -> lbox == LBox (V2 10 10) (V2 10 10) _ -> False , numSelectedEltsEqualPredicate 1 , checkHandlerNameAndState2 handlerName_boxText HAS_Active_Keyboard ] , LabelCheck "modify " , checkHandlerNameAndState2 handlerName_boxText HAS_Active_Keyboard , checkHandlerNameAndState2 handlerName_boxText HAS_Active_Keyboard , checkHandlerNameAndState2 handlerName_boxText HAS_Active_Keyboard --, checkSBoxText "" "poop" ] spec :: Spec spec = do describe "TextAreaHandler" $ do fromHUnitTest $ test_basic