Commit 92f4bcf9 authored by Leon Arnott's avatar Leon Arnott
Browse files

Added a few more tests, and updated the Readme.

parent ff6e94bb72a5
......@@ -2,13 +2,14 @@
Rough documentation is at http://twine2.neocities.org/. See below for compilation instructions.
###2.0.1 changes
###2.0.1 changes:
####Bugfixes
* Fixed a bug where `(enchant:)` applied to ?Page couldn't override CSS properties for `<tw-story>` (including the default background colour and colour).
* Fixed a Passage Editor display bug where the left margin obscured the first letter of lines.
###2.0.0 changes (also see 1.2.3 changes):
###2.0.0 changes:
####Bugfixes
......@@ -119,6 +120,17 @@ Rough documentation is at http://twine2.neocities.org/. See below for compilatio
* Added `(hover-style:)`, which, when given a style-altering changer, like `(hover-style:(text-color:green))`, makes its style only apply when the hook or expression is hovered over with the mouse pointer, and removed when hovering off.
* Now, you can specify `"none"` as a `(text-style:)` and produce a changer which, when added to other `(text-style:)` combined changers, removes their styles.
###1.2.4 changes:
####Bugfixes
* `(random:)` now no longer incorrectly errors when given a single whole number instead of two.
* `(alert:)`, `(open-url:)`, `(reload:)` and `(goto-url:)` now return empty strings rather than the non-Harlowe value `undefined` (or, for `(open-url:)` a Javascript Window object). This differs slightly from 2.0, which returns more useful command values.
* Additionally, backported the following fixes from 2.0.0:
* Fixed a bug where comparing a value with an error (such as `2 is (3 + 'X')`) would suppress the error.
* Fixed a bug where subtracting non-subtractable values (such as booleans) wouldn't produce an error, instead implicitly converting the values to numbers, and potentially producing the Javascript value `NaN`.
* Fixed the bug where `(current-time:)` wouldn't pad the minutes value with a leading 0 when necessary, and '12' was printed as '0'.
###1.2.3 changes:
####Bugfixes
......
......@@ -83,6 +83,10 @@ describe("revision macros", function() {
var p = runPassage("("+name+":'red')[blue]red");
expect(p.text()).toBe(append?'redblue':'bluered');
});
it("can target verbatim text", function() {
var p = runPassage("`[]`("+name+":'[]')[blue]");
expect(p.text()).toBe(append?'[]blue':'blue[]');
});
it("sequential "+name+"s occur one by one", function() {
var p = runPassage("red("+name+":'red')[blue]("+name+": 'blue')[green]");
expect(p.text()).toBe(append?'redbluegreen':'greenbluered');
......@@ -216,6 +220,10 @@ describe("revision macros", function() {
var p = runPassage("reded(replace:'red')[blue r]");
expect(p.text()).toBe('blue red');
});
it("can replace verbatim text", function() {
var p = runPassage("`[]`(replace:'[]')[blue]");
expect(p.text()).toBe('blue');
});
it("sequential replacements occur one by one", function() {
var p = runPassage("red(replace:'red')[blue](replace: 'blue')[green]");
expect(p.text()).toBe('green');
......
......@@ -206,9 +206,10 @@ describe("basic command macros", function() {
expect("(open-url:1)").markupToError();
expect("(open-url:'e','f')").markupToError();
});
it("produces a command which calls window.open", function() {
it("produces a command which calls window.open and prints nothing", function() {
spyOn(window,'open');
runPassage("(open-url:'http://example.org')");
var p = runPassage("foo(open-url:'http://example.org')bar");
expect(p.text()).toBe("foobar");
expect(window.open).toHaveBeenCalledWith('http://example.org','');
});
it("evaluates to a command object that can't be +'d", function() {
......
......@@ -52,6 +52,7 @@ describe("primitive value macros", function() {
});
expect("(random:1,1,1)").markupToError();
expect("(random:1,1)").not.markupToError();
expect("(random:1)").not.markupToError();
});
it("returns a random number between each value, inclusive", function() {
for(var j = 0; j < 5; j += 1) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment