diff options
Diffstat (limited to 'examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/typedarray/ArrayBufferTest.scala')
-rw-r--r-- | examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/typedarray/ArrayBufferTest.scala | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/typedarray/ArrayBufferTest.scala b/examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/typedarray/ArrayBufferTest.scala new file mode 100644 index 0000000..9e64c7f --- /dev/null +++ b/examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/typedarray/ArrayBufferTest.scala @@ -0,0 +1,39 @@ +/* __ *\ +** ________ ___ / / ___ __ ____ Scala.js Test Suite ** +** / __/ __// _ | / / / _ | __ / // __/ (c) 2013, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ http://scala-js.org/ ** +** /____/\___/_/ |_/____/_/ | |__/ /____/ ** +** |/____/ ** +\* */ +package scala.scalajs.testsuite.typedarray + +import org.scalajs.jasminetest.JasmineTest + +import scala.scalajs.js.typedarray._ + +object ArrayBufferTest extends JasmineTest { + + when("typedarry"). + describe("ArrayBuffer") { + + it("should provide a length constructor") { + val x = new ArrayBuffer(100) + expect(x.isInstanceOf[ArrayBuffer]).toBeTruthy + expect(x.byteLength).toBe(100) + } + + it("should provide `slice` with one argument") { + val x = new ArrayBuffer(100) + val y = x.slice(10) + expect(y.byteLength).toBe(90) + } + + it("should provide `slice` with two arguments") { + val x = new ArrayBuffer(100) + val y = x.slice(10, 20) + expect(y.byteLength).toBe(10) + } + + } + +} |