diff --git a/package.json b/package.json index bbb47ef..11acf56 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "scripts": { "clean": "rimraf output && rimraf .pulp-cache", "build": "eslint src && pulp build -- --censor-lib --strict", - "test": "PHANTOM_TEST_PATH=$(pwd) pulp test --runtime phantomjs" + "test": "pulp test --runtime phantomjs" }, "devDependencies": { "eslint": "^3.19.0", diff --git a/src/DOM/Event/EventTarget.purs b/src/DOM/Event/EventTarget.purs index b3494d4..dff4bcd 100644 --- a/src/DOM/Event/EventTarget.purs +++ b/src/DOM/Event/EventTarget.purs @@ -7,7 +7,7 @@ import DOM (DOM) import DOM.Event.Types (EventTarget, Event, EventType) -- | A boxed function that can be used as an event listener. This is necessary --- | due to the underling implementation of Eff functions. +-- | due to the underlying implementation of Eff functions. foreign import data EventListener :: # Effect -> Type -- | Creates an EventListener from a normal PureScript Eff function. diff --git a/src/DOM/File/Blob.js b/src/DOM/File/Blob.js index 57b51b4..81c34cb 100644 --- a/src/DOM/File/Blob.js +++ b/src/DOM/File/Blob.js @@ -3,3 +3,13 @@ exports.typeImpl = function (blob) { return blob.type; }; exports.size = function (blob) { return blob.size; }; + +exports.slice = function (contentType) { + return function (start) { + return function (end) { + return function (blob) { + return blob.slice(start, end, contentType); + }; + }; + }; +}; diff --git a/src/DOM/File/Blob.purs b/src/DOM/File/Blob.purs index 5b4d2a7..c72f84c 100644 --- a/src/DOM/File/Blob.purs +++ b/src/DOM/File/Blob.purs @@ -1,12 +1,22 @@ module DOM.File.Blob ( type_ , size + , StartByte(..) + , EndByte(..) + , idxFromInt + , idxFromNumber + , ByteIdx + , slice + , slice' ) where -import Prelude ((==)) +import DOM.File.Types (Blob) +import Data.Int (toNumber) import Data.Maybe (Maybe(..)) import Data.MediaType (MediaType(..)) -import DOM.File.Types (Blob) +import Math (round) +import Prelude ((==), (>>>)) +import Unsafe.Coerce (unsafeCoerce) foreign import typeImpl :: Blob -> String @@ -23,3 +33,36 @@ type_ blob = -- | The size (in bytes) of the data contained in the `Blob`. foreign import size :: Blob -> Number + +-- | An index into the Blob indicating the first byte to include in the new Blob. +-- | If you specify a negative value, it's treated as an offset from the end of the +-- | string toward the beginning. For example, -10 would be the 10th from last byte +-- | in the Blob. If you specify a value for start that is larger than the size +-- | of the source Blob, the returned Blob has size 0 and contains no data. +newtype StartByte = StartByte ByteIdx + +-- | An index into the Blob indicating the first byte that will *not* be included +-- | in the new Blob (i.e. the byte exactly at this index is not included). +-- | If you specify a negative value, it's treated as an offset from the end of +-- | the string toward the beginning. For example, -10 would be the 10th from +-- | last byte in the Blob. The default value is size. +newtype EndByte = EndByte ByteIdx + +foreign import data ByteIdx :: Type + +-- | Creates `ByteIdx` from `Int` value +idxFromInt :: Int -> ByteIdx +idxFromInt = toNumber >>> unsafeCoerce + +-- | Creates `ByteIdx` from `Number` value using `Math.round`. +idxFromNumber :: Number -> ByteIdx +idxFromNumber = round >>> unsafeCoerce + +-- | Creates a new `Blob` object (with specified `MediaType`), containing the +-- | data in the specified range of bytes of the source Blob, by setting . +foreign import slice ∷ MediaType -> StartByte -> EndByte -> Blob -> Blob + +-- | Creates a new `Blob` object containing the data in the specified range +-- | of bytes of the source Blob. +slice' ∷ StartByte -> EndByte -> Blob -> Blob +slice' = slice (MediaType "") diff --git a/src/DOM/HTML/Document.js b/src/DOM/HTML/Document.js index 7d23ab1..306dfa1 100644 --- a/src/DOM/HTML/Document.js +++ b/src/DOM/HTML/Document.js @@ -5,3 +5,9 @@ exports._body = function (doc) { return doc.body; }; }; + +exports._readyState = function (doc) { + return function () { + return doc.readyState; + }; +}; diff --git a/src/DOM/HTML/Document.purs b/src/DOM/HTML/Document.purs index d4115c7..553797a 100644 --- a/src/DOM/HTML/Document.purs +++ b/src/DOM/HTML/Document.purs @@ -1,15 +1,26 @@ module DOM.HTML.Document ( body + , readyState + , module Exports ) where import Prelude + import Control.Monad.Eff (Eff) -import Data.Maybe (Maybe) -import Data.Nullable (Nullable, toMaybe) import DOM (DOM) +import DOM.HTML.Document.ReadyState (ReadyState(..)) as Exports +import DOM.HTML.Document.ReadyState (ReadyState, parseReadyState) import DOM.HTML.Types (HTMLElement, HTMLDocument) +import Data.Maybe (Maybe, fromJust) +import Data.Nullable (Nullable, toMaybe) +import Partial.Unsafe (unsafePartial) foreign import _body :: forall eff. HTMLDocument -> Eff (dom :: DOM | eff) (Nullable HTMLElement) body :: forall eff. HTMLDocument -> Eff (dom :: DOM | eff) (Maybe HTMLElement) body = map toMaybe <<< _body + +foreign import _readyState :: forall eff. HTMLDocument -> Eff (dom :: DOM | eff) String + +readyState :: forall eff. HTMLDocument -> Eff (dom :: DOM | eff) ReadyState +readyState = map (unsafePartial fromJust <<< parseReadyState) <<< _readyState diff --git a/src/DOM/HTML/Document/ReadyState.purs b/src/DOM/HTML/Document/ReadyState.purs new file mode 100644 index 0000000..10c903a --- /dev/null +++ b/src/DOM/HTML/Document/ReadyState.purs @@ -0,0 +1,60 @@ +module DOM.HTML.Document.ReadyState where + +import Prelude +import Data.Enum (class Enum, class BoundedEnum, Cardinality(..), defaultSucc, defaultPred) +import Data.Maybe (Maybe(..)) + +data ReadyState + = Loading + | Interactive + | Complete + +derive instance eqReadyState :: Eq ReadyState +derive instance ordReadyState :: Ord ReadyState + +instance showReadyState :: Show ReadyState where + show = case _ of + Loading -> "Loading" + Interactive -> "Interactive" + Complete -> "Complete" + +printReadyState :: ReadyState -> String +printReadyState = case _ of + Loading -> "loading" + Interactive -> "interactive" + Complete -> "complete" + +parseReadyState :: String -> Maybe ReadyState +parseReadyState = case _ of + "loading" -> Just Loading + "interactive" -> Just Interactive + "complete" -> Just Complete + _ -> Nothing + +instance boundedReadyState :: Bounded ReadyState where + bottom = Loading + top = Complete + +instance enumReadyState :: Enum ReadyState where + succ = defaultSucc toEnumReadyState fromEnumReadyState + pred = defaultPred toEnumReadyState fromEnumReadyState + +instance boundedEnumReadyState :: BoundedEnum ReadyState where + cardinality = Cardinality 3 + toEnum = toEnumReadyState + fromEnum = fromEnumReadyState + +toEnumReadyState :: Int -> Maybe ReadyState +toEnumReadyState = + case _ of + 0 -> Just Loading + 1 -> Just Interactive + 2 -> Just Complete + _ -> Nothing + +fromEnumReadyState :: ReadyState -> Int +fromEnumReadyState = + case _ of + Loading -> 0 + Interactive -> 1 + Complete -> 2 diff --git a/src/DOM/HTML/HTMLElement.js b/src/DOM/HTML/HTMLElement.js index acc8919..b44370c 100644 --- a/src/DOM/HTML/HTMLElement.js +++ b/src/DOM/HTML/HTMLElement.js @@ -93,14 +93,6 @@ exports.setHidden = function (hidden) { // ---------------------------------------------------------------------------- -exports.click = function (elt) { - return function () { - return elt.click(); - }; -}; - -// ---------------------------------------------------------------------------- - exports.tabIndex = function (elt) { return function () { return elt.tabIndex; @@ -118,39 +110,6 @@ exports.setTabIndex = function (tabIndex) { // ---------------------------------------------------------------------------- -exports.hidden = function (elt) { - return function () { - return elt.hidden; - }; -}; - -exports.setHidden = function (hidden) { - return function (elt) { - return function () { - elt.hidden = hidden; - return {}; - }; - }; -}; - -// ---------------------------------------------------------------------------- - -exports.focus = function (elt) { - return function () { - return elt.focus(); - }; -}; - -// ---------------------------------------------------------------------------- - -exports.blur = function (elt) { - return function () { - return elt.blur(); - }; -}; - -// ---------------------------------------------------------------------------- - exports.draggable = function (elt) { return function () { return elt.draggable; @@ -206,6 +165,26 @@ exports.setSpellcheck = function (spellcheck) { }; }; +// ---------------------------------------------------------------------------- + +exports.click = function (elt) { + return function () { + return elt.click(); + }; +}; + +exports.focus = function (elt) { + return function () { + return elt.focus(); + }; +}; + +exports.blur = function (elt) { + return function () { + return elt.blur(); + }; +}; + // - CSSOM --------------------------------------------------------------------- exports.getBoundingClientRect = function (el) { diff --git a/src/DOM/HTML/Location.purs b/src/DOM/HTML/Location.purs index 5d1f4e6..9a931aa 100644 --- a/src/DOM/HTML/Location.purs +++ b/src/DOM/HTML/Location.purs @@ -38,7 +38,7 @@ foreign import hostname :: forall eff. Location -> Eff (dom :: DOM | eff) String foreign import setHostname :: forall eff. String -> Location -> Eff (dom :: DOM | eff) Unit foreign import href :: forall eff. Location -> Eff (dom :: DOM | eff) String -foreign import setHref :: forall eff. String -> Location -> Eff (dom :: DOM | eff) String +foreign import setHref :: forall eff. String -> Location -> Eff (dom :: DOM | eff) Unit foreign import origin :: forall eff. Location -> Eff (dom :: DOM | eff) String foreign import setOrigin :: forall eff. String -> Location -> Eff (dom :: DOM | eff) Unit diff --git a/src/DOM/HTML/Window.purs b/src/DOM/HTML/Window.purs index 72462e3..35707a7 100644 --- a/src/DOM/HTML/Window.purs +++ b/src/DOM/HTML/Window.purs @@ -66,7 +66,7 @@ foreign import moveBy :: forall eff. Int -> Int -> Window -> Eff (window :: WIND foreign import moveTo :: forall eff. Int -> Int -> Window -> Eff (window :: WINDOW | eff) Unit open :: forall eff. String -> String -> String -> Window -> Eff (window :: WINDOW | eff) (Maybe Window) -open window url' name features = toMaybe <$> _open window url' name features +open url' name features window = toMaybe <$> _open url' name features window foreign import _open :: forall eff diff --git a/src/DOM/Node/NodeList.js b/src/DOM/Node/NodeList.js index 4ebe582..5067a08 100644 --- a/src/DOM/Node/NodeList.js +++ b/src/DOM/Node/NodeList.js @@ -6,6 +6,12 @@ exports.length = function (list) { }; }; +exports.toArray = function (list) { + return function () { + return [].slice.call(list); + }; +}; + exports._item = function (index) { return function (list) { return function () { diff --git a/src/DOM/Node/NodeList.purs b/src/DOM/Node/NodeList.purs index 2777b98..406d701 100644 --- a/src/DOM/Node/NodeList.purs +++ b/src/DOM/Node/NodeList.purs @@ -1,6 +1,7 @@ module DOM.Node.NodeList ( length , item + , toArray ) where import Prelude @@ -13,6 +14,9 @@ import DOM.Node.Types (Node, NodeList) -- | The number of items in a NodeList. foreign import length :: forall eff. NodeList -> Eff (dom :: DOM | eff) Int +-- | The elements of a NodeList represented in an array. +foreign import toArray :: forall eff. NodeList -> Eff (dom :: DOM | eff) (Array Node) + -- | The item in a NodeList at the specified index, or Nothing if no such node -- | exists. item :: forall eff. Int -> NodeList -> Eff (dom :: DOM | eff) (Maybe Node) diff --git a/src/DOM/Websocket/WebSocket.js b/src/DOM/Websocket/WebSocket.js index 4965de8..77405ab 100644 --- a/src/DOM/Websocket/WebSocket.js +++ b/src/DOM/Websocket/WebSocket.js @@ -16,7 +16,7 @@ exports.url = function (ws) { exports.readyStateImpl = function (ws) { return function () { - return ws.readyStateImpl; + return ws.readyState; }; }; diff --git a/test/DOM/HTML/Document.purs b/test/DOM/HTML/Document.purs new file mode 100644 index 0000000..d5b5005 --- /dev/null +++ b/test/DOM/HTML/Document.purs @@ -0,0 +1,18 @@ +module Test.DOM.HTML.Document where + +import Prelude + +import Control.Monad.Eff.Class (liftEff) +import DOM (DOM) +import DOM.HTML (window) +import DOM.HTML.Document (ReadyState(..), readyState) +import DOM.HTML.Window (document) +import Test.Unit (TestSuite, describe, it) +import Test.Unit.Assert (shouldEqual) + +domHtmlDocumentTests :: forall eff. TestSuite (dom :: DOM | eff) +domHtmlDocumentTests = do + describe "readyState" do + it "should return a sensible readyState" do + rs <- liftEff $ readyState =<< document =<< window + rs `shouldEqual` Complete diff --git a/test/DOM/HTML/Window.purs b/test/DOM/HTML/Window.purs index 12bdbe7..c660a90 100644 --- a/test/DOM/HTML/Window.purs +++ b/test/DOM/HTML/Window.purs @@ -1,61 +1,39 @@ module Test.DOM.HTML.Window where -import Prelude (Unit, bind, (<<<), discard) +import Prelude + +import Control.Monad.Eff.Class (liftEff) import DOM (DOM) import DOM.HTML (window) import DOM.HTML.Types (WINDOW) -import DOM.HTML.Window -import Control.Monad.Free (Free) -import Control.Monad.Aff (Aff) -import Control.Monad.Aff.Console (CONSOLE) -import Control.Monad.Eff (Eff) -import Control.Monad.Eff.Class (liftEff) as EffClass -import Test.Unit (TestF, describe, it) -import Test.Unit.Assert (shouldEqual) +import DOM.HTML.Window as Window import Data.Maybe (isJust) -import Data.Traversable (class Traversable, sequence) - - -liftEff :: forall eff a. Eff eff a -> Aff eff a -liftEff = EffClass.liftEff - -liftSeq :: forall eff m a. Traversable m => m (Eff eff a) -> Aff eff (m a) -liftSeq = liftEff <<< sequence +import Test.Unit (TestSuite, describe, it) +import Test.Unit.Assert (shouldEqual) -domHtmlWindowTests - :: forall eff. Free (TestF (dom :: DOM, console :: CONSOLE, window :: WINDOW | eff)) Unit +domHtmlWindowTests :: forall eff. TestSuite (dom :: DOM, window :: WINDOW | eff) domHtmlWindowTests = do describe "innerHeight" do it "should return the default inner height" do - windowHeight <- liftEff do - window' <- window - innerHeight window' + windowHeight <- liftEff $ Window.innerHeight =<< window windowHeight `shouldEqual` 300 describe "innerWidth" do it "should return the default inner width" do - windowWidth <- liftEff do - window' <- window - innerWidth window' + windowWidth <- liftEff $ Window.innerWidth =<< window windowWidth `shouldEqual` 400 describe "screenX" do it "should get the X coordinate of the window" do - x <- liftEff do - window' <- window - screenX window' + x <- liftEff $ Window.screenX =<< window x `shouldEqual` 0 describe "screenY" do it "should get the Y coordinate of the window" do - y <- liftEff do - window' <- window - screenY window' + y <- liftEff $ Window.screenY =<< window y `shouldEqual` 0 describe "open" do it "should open a new window" do - newWindow' <- liftEff do - window' <- window - open "about:blank" "foobar" "" window' + newWindow' <- liftEff $ Window.open "about:blank" "foobar" "" =<< window isJust newWindow' `shouldEqual` true diff --git a/test/DOM/Node/DomTokenList.purs b/test/DOM/Node/DomTokenList.purs index 88b1885..96195ea 100644 --- a/test/DOM/Node/DomTokenList.purs +++ b/test/DOM/Node/DomTokenList.purs @@ -2,154 +2,139 @@ module Test.DOM.Node.DOMTokenList where import Prelude -import Control.Monad.Aff.Console (CONSOLE) import Control.Monad.Eff.Class (liftEff) -import Control.Monad.Free (Free) import DOM (DOM) import DOM.HTML (window) import DOM.HTML.Document (body) import DOM.HTML.HTMLElement (classList, className, setClassName) -import DOM.HTML.Types (WINDOW) import DOM.HTML.Window (document) -import DOM.Node.ClassList (add, contains, remove, toggle, toggleForce, item) as CL +import DOM.Node.ClassList as CL import Data.Maybe (Maybe(..), fromMaybe) -import Test.Unit (TestF, describe, it) +import Test.Unit (TestSuite, describe, it) import Test.Unit.Assert (shouldEqual) -domTokenListTests :: forall eff. Free (TestF (dom :: DOM, console :: CONSOLE, - window :: WINDOW | eff)) Unit +domTokenListTests :: forall eff. TestSuite (dom :: DOM | eff) domTokenListTests = do describe "DOMTokenList of classList" do it "contains a token" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b c" body'' - list <- classList body'' - CL.contains list "a" - Nothing -> pure false - + Just body'' -> liftEff do + _ <- setClassName "a b c" body'' + list <- classList body'' + CL.contains list "a" + Nothing -> pure false result `shouldEqual` true it "adds a token" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - -- clear class names, first - _ <- setClassName "" body'' - list <- classList body'' - _ <- CL.add list "a" - className body'' - Nothing -> pure "failed" - + Just body'' -> liftEff do + -- clear class names, first + _ <- setClassName "" body'' + list <- classList body'' + _ <- CL.add list "a" + className body'' + Nothing -> pure "failed" result `shouldEqual` "a" it "removes a token" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b c" body'' - list <- classList body'' - _ <- CL.remove list "b" - resultA <- CL.contains list "a" - resultB <- CL.contains list "b" - resultC <- CL.contains list "c" - -- Only "b" should be removed - pure $ resultA && not resultB && resultC - Nothing -> pure false - + Just body'' -> liftEff do + _ <- setClassName "a b c" body'' + list <- classList body'' + _ <- CL.remove list "b" + resultA <- CL.contains list "a" + resultB <- CL.contains list "b" + resultC <- CL.contains list "c" + -- Only "b" should be removed + pure $ resultA && not resultB && resultC + Nothing -> pure false result `shouldEqual` true it "toggles a token by removing its value" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b c" body'' - list <- classList body'' - _ <- CL.toggle list "c" - className body'' - Nothing -> pure "failed" - + Just body'' -> liftEff do + _ <- setClassName "a b c" body'' + list <- classList body'' + _ <- CL.toggle list "c" + className body'' + Nothing -> pure "failed" result `shouldEqual` "a b" it "toggles a token by adding its value" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b" body'' - list <- classList body'' - _ <- CL.toggle list "c" - className body'' - Nothing -> pure "failed" - + Just body'' -> liftEff do + _ <- setClassName "a b" body'' + list <- classList body'' + _ <- CL.toggle list "c" + className body'' + Nothing -> pure "failed" result `shouldEqual` "a b c" it "toggles a token by forcing to add its value" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b" body'' - list <- classList body'' - _ <- CL.toggleForce list "c" true - className body'' - Nothing -> pure "failed" - + Just body'' -> liftEff do + _ <- setClassName "a b" body'' + list <- classList body'' + _ <- CL.toggleForce list "c" true + className body'' + Nothing -> pure "failed" result `shouldEqual` "a b c" it "toggles a token by forcing to add (but not to remove) its value" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b c" body'' - list <- classList body'' - _ <- CL.toggleForce list "c" true - className body'' - Nothing -> pure "failed" - + Just body'' -> liftEff do + _ <- setClassName "a b c" body'' + list <- classList body'' + _ <- CL.toggleForce list "c" true + className body'' + Nothing -> pure "failed" result `shouldEqual` "a b c" it "toggles a token by forcing to remove its value" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b c" body'' - list <- classList body'' - _ <- CL.toggleForce list "c" false - className body'' - Nothing -> pure "failed" - + Just body'' -> liftEff do + _ <- setClassName "a b c" body'' + list <- classList body'' + _ <- CL.toggleForce list "c" false + className body'' + Nothing -> pure "failed" result `shouldEqual` "a b" it "toggles a token by forcing to remove (but not to add) its value" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b" body'' - list <- classList body'' - _ <- CL.toggleForce list "c" false - className body'' - Nothing -> pure "failed" - + Just body'' -> liftEff do + _ <- setClassName "a b" body'' + list <- classList body'' + _ <- CL.toggleForce list "c" false + className body'' + Nothing -> pure "failed" result `shouldEqual` "a b" it "returns an item if available" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b c" body'' - list <- classList body'' - CL.item list 2 - Nothing -> pure Nothing - + Just body'' -> liftEff do + _ <- setClassName "a b c" body'' + list <- classList body'' + CL.item list 2 + Nothing -> pure Nothing (fromMaybe "not found" result) `shouldEqual` "c" it "returns not an item if it's not available" do body' <- liftEff $ window >>= document >>= body result <- case body' of - Just body'' -> liftEff do - _ <- setClassName "a b c" body'' - list <- classList body'' - CL.item list 5 - Nothing -> pure Nothing - + Just body'' -> liftEff do + _ <- setClassName "a b c" body'' + list <- classList body'' + CL.item list 5 + Nothing -> pure Nothing (fromMaybe "not found" result) `shouldEqual` "not found" diff --git a/test/Main.purs b/test/Main.purs index 13c0c44..94c255b 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -1,32 +1,23 @@ module Test.Main where -import Prelude (($), discard) -import Control.Monad.Aff (launchAff, Canceler) +import Prelude + import Control.Monad.Aff.AVar (AVAR) +import Control.Monad.Aff.Console (CONSOLE) import Control.Monad.Eff (Eff) -import Control.Monad.Eff.Class (liftEff) -import Control.Monad.Eff.Console (CONSOLE) -import Control.Monad.Eff.Exception (EXCEPTION) +import Control.Monad.Eff.Timer (TIMER, setTimeout) import DOM (DOM) import DOM.HTML.Types (WINDOW) -import Data.Enum (fromEnum) -import ExitCodes (ExitCode(Success)) -import PhantomJS.Phantom (exit, PHANTOMJS) +import Test.DOM.HTML.Document (domHtmlDocumentTests) import Test.DOM.HTML.Window (domHtmlWindowTests) import Test.DOM.Node.DOMTokenList (domTokenListTests) -import Test.Unit (describe, it) -import Test.Unit.Assert (assert) -import Test.Unit.Output.Simple (runTest) - -main - :: forall eff - . Eff (exception :: EXCEPTION, console :: CONSOLE, avar :: AVAR, dom :: DOM, window :: WINDOW, phantomjs :: PHANTOMJS | eff) - (Canceler (console :: CONSOLE, avar :: AVAR, dom :: DOM, window :: WINDOW, phantomjs :: PHANTOMJS | eff)) -main = launchAff $ runTest do - domHtmlWindowTests - domTokenListTests +import Test.Unit.Console (TESTOUTPUT) +import Test.Unit.Main (runTest, exit) - describe "exit" $ do - it "should exit" $ do - liftEff $ exit (fromEnum Success) - assert "failed to exit phantomjs" false +main :: Eff (console :: CONSOLE, testOutput :: TESTOUTPUT, avar :: AVAR, dom :: DOM, window :: WINDOW, timer :: TIMER) Unit +main = do + runTest do + domHtmlDocumentTests + domHtmlWindowTests + domTokenListTests + void $ setTimeout 100 $ exit 0