Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update babel to use preset-env #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
SHELL := env PATH=$(PATH) /bin/bash

name := tenuki

Expand All @@ -23,7 +23,7 @@ test: all

build/$(name).js: build $(compiled_js)
cat copyright_header.txt \
<(browserify index.js --standalone $(name) -t [ babelify --presets [ es2015 ] ]) \
<(browserify index.js --standalone $(name) -t [ babelify --presets [ @babel/preset-env ] ]) \
> $@

build/$(name).min.js: build/$(name).js
Expand All @@ -44,7 +44,7 @@ build/$(name).min.css: build/$(name).css
lib/%.js: src/%.js
babel \
--source-maps \
--presets es2015 \
--presets @babel/preset-env \
--out-file $@ \
$<

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
},
"homepage": "https://github.com/aprescott/tenuki#readme",
"devDependencies": {
"babel-cli": "^6.7.7",
"babel-preset-es2015": "*",
"@babel/cli": "^7.19.3",
"@babel/core": "^7.20.5",
"@babel/preset-env": "^7.20.2",
"babelify": "*",
"body-parser": "^1.15.1",
"browserify": "8",
Expand Down
2 changes: 1 addition & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Client.prototype = {
if (this._boardElement) {
this._game = new Game(Object.assign({ element: this._boardElement }, gameOptions));
} else {
this._game = new Game(...gameOptions);
this._game = new Game({...gameOptions});
}
},

Expand Down
24 changes: 24 additions & 0 deletions test/highlight-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var helpers = require("./helpers.js");
var expect = require("chai").expect;
var tenuki = require("../index.js");
var Game = tenuki.Game;
var utils = tenuki.utils;

describe("Board highlights", function() {
beforeEach(function() {
helpers.generateNewTestBoard();
});
["svg", "dom"].forEach(renderer => {
describe(`${renderer} renderer`, function() {
it("can highlight empty spaces", function() {
var testBoardElement = document.querySelector("#test-board");

var game = new Game({ element: testBoardElement, boardSize: 5, renderer: renderer });

expect(utils.hasClass(testBoardElement.querySelectorAll(".intersection")[1], "highlight")).to.be.false;
game.highlightAt(1,1);
expect(utils.hasClass(testBoardElement.querySelectorAll(".intersection")[1], "highlight")).to.be.true;
});
});
});
});