Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ampersand-chess-state

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-chess-state - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

ampersand-chess-state.js

2

examples/changes.js
/* global console */
var Chess = require('../ampersand-chess');
var Chess = require('../ampersand-chess-state');
var chess = new Chess();

@@ -5,0 +5,0 @@ var log = function (prefix, model, value) { console.log(prefix, JSON.stringify(value)); };

{
"name": "ampersand-chess-state",
"description": "An evented chess library for movement, validation and result detection built on Ampersand.js.",
"version": "0.1.3",
"version": "0.1.4",
"author": "Luke Karrys <luke@lukekarrys.com>",

@@ -31,3 +31,3 @@ "bugs": "https://github.com/lukekarrys/ampersand-chess-state/issues",

"license": "MIT",
"main": "ampersand-chess.js",
"main": "ampersand-chess-state.js",
"repository": {

@@ -34,0 +34,0 @@ "type": "git",

@@ -31,3 +31,3 @@ ampersand-chess-state

```js
var Chess = require('../ampersand-chess');
var Chess = require('../ampersand-chess-state');
var chess = new Chess();

@@ -34,0 +34,0 @@ var log = function (prefix, model, value) { console.log(prefix, JSON.stringify(value)); };

var test = require('tape');
var Chess = require('../ampersand-chess');
var Chess = require('../ampersand-chess-state');
Function.prototype.bind = require('function-bind');

@@ -401,3 +401,15 @@

t.equal(chess.pgnArray[29].ply1.active, true);
t.equal(chess.pgnArray[29].ply1.san, 'Ra8#');
t.equal(chess.pgnArray[29].move, 30);
chess.undo();
chess.undo();
t.equal(chess.pgnArray[29].ply1.active, void 0);
t.equal(chess.pgnArray[29].ply1.san, 'Ra8#');
t.equal(chess.pgnArray[29].move, 30);
t.equal(chess.pgnArray[28].ply1.active, true);
t.equal(chess.pgnArray[28].ply1.san, 'Qe7+');
t.equal(chess.pgnArray[28].move, 29);
t.end();

@@ -500,2 +512,31 @@ });

t.end();
});
test('finalPgn stays the same during replay and after', function (t) {
var pgn = '1. f4 d6 2. e4 b5 3. g4 c6 4. a3 a6';
var chess = new Chess({pgn: pgn});
t.equal(chess._finalPgn, pgn);
t.equal(chess.pgn, pgn);
chess.undo();
chess.undo();
t.equal(chess.pgn, pgn.replace(' 4. a3 a6', ''));
t.equal(chess._finalPgn, pgn);
chess.redo();
chess.redo();
t.equal(chess.pgn, pgn);
t.equal(chess._finalPgn, pgn);
chess.move('b4');
chess.move('e5');
t.equal(chess.pgn, pgn + ' 5. b4 e5');
t.equal(chess._finalPgn, pgn + ' 5. b4 e5');
chess.pgn = '1. a4 a5 2. b4 b5';
t.equal(chess.pgn, '1. a4 a5 2. b4 b5');
t.equal(chess._finalPgn, '1. a4 a5 2. b4 b5');
t.end();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc