forked from scala-js/scala-js-env-selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix scala-js#115: Add ESModule support
- Loading branch information
Showing
6 changed files
with
76 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
seleniumJSHttpESModuleEnvTest/src/main/scala/org/scalajs/jsenv/selenium/CamelCase.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.scalajs.jsenv.selenium | ||
|
||
object CamelCase { | ||
def hello(input: String): String = s"Hello ${CamelcaseEsModule(input)}!" | ||
} |
10 changes: 10 additions & 0 deletions
10
...umJSHttpESModuleEnvTest/src/main/scala/org/scalajs/jsenv/selenium/CamelcaseEsModule.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.scalajs.jsenv.selenium | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation.JSImport | ||
|
||
@JSImport("https://cdn.skypack.dev/camelcase@^6.0.0", JSImport.Default) | ||
@js.native | ||
object CamelcaseEsModule extends js.Object { | ||
def apply(input: String): String = js.native | ||
} |
10 changes: 10 additions & 0 deletions
10
seleniumJSHttpESModuleEnvTest/src/test/scala/org/scalajs/jsenv/selenium/CamelCaseTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.scalajs.jsenv.selenium | ||
|
||
import org.junit.Assert._ | ||
import org.junit.Test | ||
|
||
class CamelCaseTest { | ||
@Test def CamelCaseTest(): Unit = { | ||
assertEquals("Hello scalaJsSelenium!", CamelCase.hello("scala js selenium")) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
seleniumJSHttpESModuleEnvTest/src/test/scala/org/scalajs/jsenv/selenium/LocationTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.scalajs.jsenv.selenium | ||
|
||
import org.junit.Assert._ | ||
import org.junit.Test | ||
|
||
import scala.scalajs.js.Dynamic.global | ||
|
||
class LocationTest { | ||
|
||
@Test def LocationTest(): Unit = { | ||
assertEquals("http:", global.window.location.protocol.toString()) | ||
assertEquals("localhost:8080", global.window.location.host.toString()) | ||
} | ||
} |