summaryrefslogtreecommitdiff
path: root/examples/scala-js/test-suite/src/test/scala/scala/scalajs/testsuite/typedarray/ArrayBufferTest.scala
blob: 9e64c7fa057e56392e2536a65e0ff4ccc7793703 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)
    }

  }

}