cm-chessboard 4.1.9 → 4.1.10

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.1.9",
3
+ "version": "4.1.10",
4
4
  "description": "A JavaScript chessboard which is lightweight, ES6 module based, responsive, SVG rendered and without dependencies.",
5
5
  "keywords": [
6
6
  "chess",
@@ -166,8 +166,7 @@ export class Chessboard {
166
166
  }
167
167
 
168
168
  removeMarkers(square = undefined, type = undefined) {
169
- const index = square ? this.state.squareToIndex(square) : undefined
170
- this.state.removeMarkers(index, type)
169
+ this.state.removeMarkers(square, type)
171
170
  this.view.drawMarkers()
172
171
  }
173
172
 
@@ -49,7 +49,7 @@ export class ChessboardState {
49
49
  this.markers = []
50
50
  } else {
51
51
  this.markers = this.markers.filter((marker) => {
52
- if (!marker.type) {
52
+ if (!type) {
53
53
  if (square === marker.square) {
54
54
  return false
55
55
  }
@@ -26,6 +26,15 @@ describe("TestMarkers", () => {
26
26
  assert.equals(chessboard.getMarkers("a4").length, 0)
27
27
  assert.equals(chessboard.getMarkers(undefined, MARKER_TYPE.frame).length, 2)
28
28
  assert.equals(chessboard.getMarkers("b6", MARKER_TYPE.frame).length, 1)
29
+ assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 1)
30
+ chessboard.removeMarkers("h6")
31
+ assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 0)
32
+ chessboard.addMarker("h6", MARKER_TYPE.frame)
33
+ assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 1)
34
+ chessboard.removeMarkers("h6", MARKER_TYPE.square)
35
+ assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 1)
36
+ chessboard.removeMarkers("h6", MARKER_TYPE.frame)
37
+ assert.equals(chessboard.getMarkers("h6", MARKER_TYPE.frame).length, 0)
29
38
  chessboard.destroy()
30
39
  })
31
40