cm-chessboard 4.5.1 → 4.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chessboard",
3
- "version": "4.5.1",
3
+ "version": "4.5.2",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
package/test/TestBoard.js CHANGED
@@ -23,9 +23,9 @@ describe("TestBoard", () => {
23
23
  sprite: {url: "../assets/images/chessboard-sprite.svg"},
24
24
  position: "start"
25
25
  })
26
- assert.equals(chessboard.view.context.childNodes.length, 1)
26
+ assert.equal(chessboard.view.context.childNodes.length, 1)
27
27
  chessboard.destroy()
28
- assert.equals(chessboard.state, undefined)
28
+ assert.equal(chessboard.state, undefined)
29
29
  })
30
30
 
31
31
  })
@@ -14,7 +14,7 @@ describe("TestChessboard", () => {
14
14
  sprite: {url: "../assets/images/chessboard-sprite.svg"},
15
15
  position: "start"
16
16
  })
17
- assert.equals(chessboard.getPosition(), "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR")
17
+ assert.equal(chessboard.getPosition(), "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR")
18
18
  chessboard.destroy()
19
19
  })
20
20
 
@@ -22,7 +22,7 @@ describe("TestChessboard", () => {
22
22
  const chessboard = new Chessboard(document.getElementById("TestPosition"),
23
23
  {sprite: {url: "../assets/images/chessboard-sprite.svg"},})
24
24
  chessboard.setPosition("rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR w Gkq - 4 11", false).then(() => {
25
- assert.equals(chessboard.getPosition(), "rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR")
25
+ assert.equal(chessboard.getPosition(), "rn2k1r1/ppp1pp1p/3p2p1/5bn1/P7/2N2B2/1PPPPP2/2BNK1RR")
26
26
  chessboard.destroy()
27
27
  })
28
28
  })
@@ -32,9 +32,9 @@ describe("TestChessboard", () => {
32
32
  sprite: {url: "../assets/images/chessboard-sprite.svg"},
33
33
  position: "start"
34
34
  })
35
- assert.equals(chessboard.getPiece("d1"), "wq")
36
- assert.equals(chessboard.getPiece("d8"), "bq")
37
- assert.equals(chessboard.getPiece("a2"), "wp")
35
+ assert.equal(chessboard.getPiece("d1"), "wq")
36
+ assert.equal(chessboard.getPiece("d8"), "bq")
37
+ assert.equal(chessboard.getPiece("a2"), "wp")
38
38
  chessboard.destroy()
39
39
  })
40
40
 
@@ -44,9 +44,9 @@ describe("TestChessboard", () => {
44
44
  sprite: {url: "../assets/images/chessboard-sprite.svg"},
45
45
  })
46
46
  chessboard.setPiece("a1", PIECE.bk)
47
- assert.equals(chessboard.getPiece("a1"), "bk")
47
+ assert.equal(chessboard.getPiece("a1"), "bk")
48
48
  chessboard.setPiece("e5", PIECE.wk)
49
- assert.equals(chessboard.getPiece("e5"), "wk")
49
+ assert.equal(chessboard.getPiece("e5"), "wk")
50
50
  chessboard.destroy()
51
51
  })
52
52
 
@@ -17,24 +17,24 @@ describe("TestMarkers", () => {
17
17
  chessboard.addMarker("e5", MARKER_TYPE.square)
18
18
  chessboard.addMarker("b6", MARKER_TYPE.frame)
19
19
  chessboard.addMarker("h6", MARKER_TYPE.frame)
20
- assert.equals(chessboard.getMarkers().length,3)
20
+ assert.equal(chessboard.getMarkers().length,3)
21
21
  const markersE5 = chessboard.getMarkers("e5")
22
- assert.equals(markersE5.length, 1)
23
- assert.equals(markersE5[0].square, "e5")
24
- assert.equals(markersE5[0].type.slice, "markerSquare")
25
- assert.equals(chessboard.getMarkers(undefined, MARKER_TYPE.square).length, 1)
26
- assert.equals(chessboard.getMarkers("a4").length, 0)
27
- assert.equals(chessboard.getMarkers(undefined, MARKER_TYPE.frame).length, 2)
28
- assert.equals(chessboard.getMarkers("b6", MARKER_TYPE.frame).length, 1)
29
- assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 1)
22
+ assert.equal(markersE5.length, 1)
23
+ assert.equal(markersE5[0].square, "e5")
24
+ assert.equal(markersE5[0].type.slice, "markerSquare")
25
+ assert.equal(chessboard.getMarkers(undefined, MARKER_TYPE.square).length, 1)
26
+ assert.equal(chessboard.getMarkers("a4").length, 0)
27
+ assert.equal(chessboard.getMarkers(undefined, MARKER_TYPE.frame).length, 2)
28
+ assert.equal(chessboard.getMarkers("b6", MARKER_TYPE.frame).length, 1)
29
+ assert.equal(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 1)
30
30
  chessboard.removeMarkers("h6")
31
- assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 0)
31
+ assert.equal(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 0)
32
32
  chessboard.addMarker("h6", MARKER_TYPE.frame)
33
- assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 1)
33
+ assert.equal(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 1)
34
34
  chessboard.removeMarkers("h6", MARKER_TYPE.square)
35
- assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 1)
35
+ assert.equal(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 1)
36
36
  chessboard.removeMarkers("h6", MARKER_TYPE.frame)
37
- assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 0)
37
+ assert.equal(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 0)
38
38
  chessboard.destroy()
39
39
  })
40
40
 
@@ -10,14 +10,14 @@ import {PositionsAnimation} from "../src/cm-chessboard/view/PositionAnimationsQu
10
10
 
11
11
  describe("TestPiecesAnimation", () => {
12
12
  it("should calculate square distances", () => {
13
- assert.equals(PositionsAnimation.squareDistance(0, 0), 0)
14
- assert.equals(PositionsAnimation.squareDistance(0, 1), 1)
15
- assert.equals(PositionsAnimation.squareDistance(0, 7), 7)
16
- assert.equals(PositionsAnimation.squareDistance(0, 8), 1)
17
- assert.equals(PositionsAnimation.squareDistance(10, 20), 2)
18
- assert.equals(PositionsAnimation.squareDistance(0, 63), 7)
19
- assert.equals(PositionsAnimation.squareDistance(8, 24), 2)
20
- assert.equals(PositionsAnimation.squareDistance(14, 24), 6)
13
+ assert.equal(PositionsAnimation.squareDistance(0, 0), 0)
14
+ assert.equal(PositionsAnimation.squareDistance(0, 1), 1)
15
+ assert.equal(PositionsAnimation.squareDistance(0, 7), 7)
16
+ assert.equal(PositionsAnimation.squareDistance(0, 8), 1)
17
+ assert.equal(PositionsAnimation.squareDistance(10, 20), 2)
18
+ assert.equal(PositionsAnimation.squareDistance(0, 63), 7)
19
+ assert.equal(PositionsAnimation.squareDistance(8, 24), 2)
20
+ assert.equal(PositionsAnimation.squareDistance(14, 24), 6)
21
21
  })
22
22
 
23
23
  it("should seek changes", () => {
@@ -29,24 +29,24 @@ describe("TestPiecesAnimation", () => {
29
29
  const newBoard1 = state2.position.squares
30
30
  const changes = PositionsAnimation.seekChanges(previousBoard1, newBoard1)
31
31
 
32
- assert.equals(changes[0].type,0 )
33
- assert.equals(changes[0].piece, "wn")
34
- assert.equals(changes[0].atIndex, 1)
35
- assert.equals(changes[0].toIndex,3)
32
+ assert.equal(changes[0].type,0 )
33
+ assert.equal(changes[0].piece, "wn")
34
+ assert.equal(changes[0].atIndex, 1)
35
+ assert.equal(changes[0].toIndex,3)
36
36
 
37
- assert.equals(changes[2].type, 0)
38
- assert.equals(changes[2].piece, "wn")
39
- assert.equals(changes[2].atIndex, 6)
40
- assert.equals(changes[2].toIndex, 18)
37
+ assert.equal(changes[2].type, 0)
38
+ assert.equal(changes[2].piece, "wn")
39
+ assert.equal(changes[2].atIndex, 6)
40
+ assert.equal(changes[2].toIndex, 18)
41
41
 
42
- assert.equals(changes[4].type,0 )
43
- assert.equals(changes[4].piece, "wp")
44
- assert.equals(changes[4].atIndex, 8)
45
- assert.equals(changes[4].toIndex, 24)
42
+ assert.equal(changes[4].type,0 )
43
+ assert.equal(changes[4].piece, "wp")
44
+ assert.equal(changes[4].atIndex, 8)
45
+ assert.equal(changes[4].toIndex, 24)
46
46
 
47
- assert.equals(changes[13].type, 2)
48
- assert.equals(changes[13].piece, "bq")
49
- assert.equals(changes[13].atIndex, 59)
47
+ assert.equal(changes[13].type, 2)
48
+ assert.equal(changes[13].piece, "bq")
49
+ assert.equal(changes[13].atIndex, 59)
50
50
  })
51
51
 
52
52
  })
@@ -9,17 +9,17 @@ import {Position} from "../src/cm-chessboard/model/Position.js"
9
9
 
10
10
  describe("TestPosition", () => {
11
11
  it("should convert square to index", () => {
12
- assert.equals(Position.squareToIndex("a1"), 0)
13
- assert.equals(Position.squareToIndex("h1"), 7)
14
- assert.equals(Position.squareToIndex("a8"), 56)
15
- assert.equals(Position.squareToIndex("g5"), 38)
16
- assert.equals(Position.squareToIndex("h8"), 63)
12
+ assert.equal(Position.squareToIndex("a1"), 0)
13
+ assert.equal(Position.squareToIndex("h1"), 7)
14
+ assert.equal(Position.squareToIndex("a8"), 56)
15
+ assert.equal(Position.squareToIndex("g5"), 38)
16
+ assert.equal(Position.squareToIndex("h8"), 63)
17
17
  })
18
18
  it("should convert index to square", () => {
19
- assert.equals(Position.indexToSquare(0), "a1")
20
- assert.equals(Position.indexToSquare(7), "h1")
21
- assert.equals(Position.indexToSquare(56), "a8")
22
- assert.equals(Position.indexToSquare(38), "g5")
23
- assert.equals(Position.indexToSquare(63), "h8")
19
+ assert.equal(Position.indexToSquare(0), "a1")
20
+ assert.equal(Position.indexToSquare(7), "h1")
21
+ assert.equal(Position.indexToSquare(56), "a8")
22
+ assert.equal(Position.indexToSquare(38), "g5")
23
+ assert.equal(Position.indexToSquare(63), "h8")
24
24
  })
25
25
  })