cm-chess 3.6.0 → 3.6.1

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-chess",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "It's like chess.js, but in ES6 and can handle variations (tree-structured move history)",
5
5
  "main": "./src/Chess.js",
6
6
  "type": "module",
package/src/Chess.js CHANGED
@@ -247,12 +247,15 @@ export class Chess {
247
247
 
248
248
  /**
249
249
  * Load a PGN with variations, NAGs, header and annotations. cm-chess uses cm-pgn
250
- * fot the header and history. See https://github.com/shaack/cm-pgn
250
+ * for the header and history. See https://github.com/shaack/cm-pgn
251
251
  * @param pgn
252
252
  * @param sloppy to allow sloppy SAN
253
253
  */
254
254
  loadPgn(pgn, sloppy = this.props.sloppy) {
255
255
  this.pgn = new Pgn(pgn, {sloppy: sloppy})
256
+ if(this.pgn.props.chess960) {
257
+ this.props.gameVariant = GAME_VARIANT.chess960
258
+ }
256
259
  publishEvent(this.observers, {type: EVENT_TYPE.initialized, pgn: pgn})
257
260
  }
258
261
 
@@ -58,6 +58,7 @@ N3xd4 exd4 28. Bxd4 Nac5 29. Bxf6 Nxf6 30. c7 b3 31. axb3 Na6 32. Kb1 Nb4
58
58
  33. Qc4 Ne8 34. Rd8 Qxf5+ 35. Ka1 Nc2+ 36. Qxc2 1-0`
59
59
  const chess = new Chess()
60
60
  chess.loadPgn(pgn)
61
+ assert.equal(chess.props.gameVariant, GAME_VARIANT.chess960)
61
62
  assert.equal(chess.fen(), "2rRn2k/2P3pp/8/pN3q2/8/1P6/1PQ4P/K5R1 b - - 0 36")
62
63
  })
63
64
  })