diff options
author | Haoyi Li <haoyi@haoyi-mbp.corp.dropbox.com> | 2014-11-26 00:50:50 -0800 |
---|---|---|
committer | Haoyi Li <haoyi@haoyi-mbp.corp.dropbox.com> | 2014-11-26 00:50:50 -0800 |
commit | 88595a41e3ec13c1a516e847fe3d0b279facf3fc (patch) | |
tree | 4f03b902de7b81fa2e32792e84b680038345e761 /examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/jsinterop/DictionaryTest.scala | |
parent | 82773a11c99d260e97ca63356bfb7b417599b1e9 (diff) | |
download | hands-on-scala-js-88595a41e3ec13c1a516e847fe3d0b279facf3fc.tar.gz hands-on-scala-js-88595a41e3ec13c1a516e847fe3d0b279facf3fc.tar.bz2 hands-on-scala-js-88595a41e3ec13c1a516e847fe3d0b279facf3fc.zip |
killed
Diffstat (limited to 'examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/jsinterop/DictionaryTest.scala')
-rw-r--r-- | examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/jsinterop/DictionaryTest.scala | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/jsinterop/DictionaryTest.scala b/examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/jsinterop/DictionaryTest.scala deleted file mode 100644 index 8b45395..0000000 --- a/examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/jsinterop/DictionaryTest.scala +++ /dev/null @@ -1,79 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ __ ____ Scala.js Test Suite ** -** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ http://scala-js.org/ ** -** /____/\___/_/ |_/____/_/ | |__/ /____/ ** -** |/____/ ** -\* */ -package scala.scalajs.testsuite.jsinterop - -import scala.scalajs.js -import org.scalajs.jasminetest.JasmineTest - -object DictionaryTest extends JasmineTest { - - describe("scala.scalajs.js.Dictionary") { - - it("should provide an equivalent of the JS delete keyword - #255") { - val obj = js.Dictionary.empty[js.Any] - obj("foo") = 42 - obj("bar") = "foobar" - - expect(obj("foo")).toEqual(42) - expect(obj("bar")).toEqual("foobar") - obj.delete("foo") - expect(obj("foo")).toBeUndefined - expect(obj.asInstanceOf[js.Object].hasOwnProperty("foo")).toBeFalsy - expect(obj("bar")).toEqual("foobar") - } - - // This doesn't work on Rhino due to lack of full strict mode support - #679 - unless("rhino"). - it("should behave as specified when deleting a non-configurable property - #461 - #679") { - val obj = js.Dictionary.empty[js.Any] - js.Object.defineProperty(obj.asInstanceOf[js.Object], "nonconfig", - js.Dynamic.literal(value = 4, writable = false).asInstanceOf[js.PropertyDescriptor]) - expect(obj("nonconfig")).toEqual(4) - expect(() => obj.delete("nonconfig")).toThrow - expect(obj("nonconfig")).toEqual(4) - } - - it("should provide `get`") { - val obj = js.Dictionary.empty[Int] - obj("hello") = 1 - - expect(obj.get("hello").isDefined).toBeTruthy - expect(obj.get("world").isDefined).toBeFalsy - } - - it("should treat delete as a statement - #907") { - val obj = js.Dictionary("a" -> "A") - obj.delete("a") - } - - it("should desugar arguments to delete statements - #908") { - val kh = js.Dynamic.literal( key = "a" ).asInstanceOf[KeyHolder] - val dict = js.Dictionary[String]("a" -> "A") - def a[T](foo: String) = dict.asInstanceOf[T] - a[js.Dictionary[String]]("foo").delete(kh.key) - } - - } - - trait KeyHolder extends js.Object { - def key: String = js.native - } - - describe("scala.scalajs.js.JSConverters.JSRichGenMap") { - - import js.JSConverters._ - - it("should provide toJSDictionary") { - expect(Map("a" -> 1, "b" -> 2).toJSDictionary).toEqual( - js.Dynamic.literal(a = 1, b = 2)) - expect(Map("a" -> "foo", "b" -> "bar").toJSDictionary).toEqual( - js.Dynamic.literal(a = "foo", b = "bar")) - } - - } -} |