{-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings, TypeFamilies #-} module AngularSpec where import Data.Monoid import RunGenerator import Test.HUnit import Test.Hspec import Text.Hamlet (xhtmlHamletSettings) import Yesod.Core import Yesod.EmbeddedStatic.AngularJavascript import Yesod.Test hiding (assertEqual) import qualified Data.ByteString.Lazy as BL ang1 :: GeneratorTestResult ang1 = head $(testGen (embedNgModuleWithoutTemplates "mod1" "a/b/c/def.js" "test/angular/mod1" (\x -> return $ x <> "\nAdded by mini") ) [("a/b/c/def.js", "application/javascript", "test/angular/mod1.js.expected")]) ang2s :: [GeneratorTestResult] ang2s = $(testGen (embedNgModulesWithoutTemplates "angmod" "test/angular" (\x -> return $ x <> "\nAdded by mini") ) [("angmod/mod1.js", "application/javascript", "test/angular/mod1.js.expected") ,("angmod/mod2.js", "application/javascript", "test/angular/mod2.js.expected") ]) ang3 :: GeneratorTestResult ang3 = head $(testGen (embedNgModule "mod1" "module1.js" "test/angular/mod1" (\x -> return $ x <> "\nAdded by mini") ) [("module1.js", "application/javascript", "test/angular/mod1-and-templ.js.expected")]) ang4s :: [GeneratorTestResult] ang4s = $(testGen (embedNgModules "xxx" "test/angular" (\x -> return $ x <> "\nAdded by mini") ) [("xxx/mod1.js", "application/javascript", "test/angular/mod1-and-templ.js.expected") ,("xxx/mod2.js", "application/javascript", "test/angular/mod2.js.expected") ]) data MyApp = MyApp mkYesod "MyApp" [parseRoutes| /single SingleWidgetR GET /files DirectiveFilesR GET /filesxhtml DirFilesXHTML GET |] instance Yesod MyApp getSingleWidgetR :: Handler Html getSingleWidgetR = defaultLayout $ do let direct = directiveWidget "mydirect" $(whamletFile "test/angular/mod1/my-tabs.hamlet") [whamlet|