Commit 1a511920 authored by Leon Arnott's avatar Leon Arnott
Browse files

Fixed a bug where (enchant:?Link) couldn't override the default CSS link colour.

parent 4f6145d89d26
......@@ -6,9 +6,11 @@ Rough documentation is at http://twine2.neocities.org/. See below for compilatio
####Bugfixes
* Now, using `(enchant:)` to change the `(text-colour:)` of `?Link` (normal links) will correctly override the default CSS link colour.
* Fixed a bug where the alternative macro spellings `(text-color:)` and `(color:)` were displayed as erroneous in the editor.
* Now, `(enchant:)` correctly displays an error when the changer provided to it includes a `(replace:)`, `(append:)` or `(prepend:)` command.
* Re-fixed the bug where `(pow:)` only accepted 1 value instead of 2, and also fixed `(sqrt:)` and the `(log:)` variants, which weren't working at all.
* Fixed a parsing bug where `5*3-2`, without whitespace around the minus sign, would break the order of operations.
####Alterations
......
......@@ -8,8 +8,16 @@ tw-link, .link, tw-icon, .enchantment-clickblock {
cursor: pointer;
}
@mixin enchantable-color {
tw-enchantment[style^="color"] &:not(:hover),
tw-enchantment[style*=" color"] &:not(:hover) {
color: inherit;
}
}
tw-link, .enchantment-link {
color: $linkcolour;
@include enchantable-color;
font-weight: bold;
text-decoration: none;
......@@ -25,6 +33,7 @@ tw-link, .enchantment-link {
.visited {
color: $visitedcolour;
@include enchantable-color;
&:hover {
color: $visitedhovercolour;
}
......@@ -32,6 +41,7 @@ tw-link, .enchantment-link {
tw-broken-link {
color: #993333; // A clotted blood colour
@include enchantable-color;
border-bottom: 2px solid #993333;
cursor: not-allowed;
}
......
......@@ -15,6 +15,26 @@ describe("enchantment macros", function () {
});
//TODO: write more basic functionality tests comparable to (click:)'s
});
describe("enchanting ?Link", function() {
it("wraps each <tw-link> in a <tw-enchantment>", function(done) {
createPassage("","bar");
runPassage("(enchant:?Link,(text-style:'italic'))[[Next->bar]]");
setTimeout(function() {
var enchantment = $('tw-link').parent();
expect(enchantment.is('tw-enchantment')).toBe(true);
expect(enchantment.attr('style')).toMatch(/font-style: \s*italic/);
done();
});
});
it("can override properties that <tw-link> inherits from CSS", function(done) {
createPassage("","bar");
runPassage("(enchant:?Link,(text-style:'blur')+(color:'#800000'))[[Next->bar]]");
setTimeout(function() {
expect($('tw-link').css('color')).toMatch(/(?:#800000|rgb\(\s*128,\s*0,\s*0\s*\))/);
done();
},400);
});
});
describe("enchanting ?Page", function() {
it("wraps the ?Page in a <tw-enchantment>", function(done) {
runPassage("(enchant:?Page,(text-style:'bold'))");
......
......@@ -54,6 +54,13 @@ describe("list markup", function() {
"<ul><li>A</li></ul>B"
);
});
xit("work inside hooks", function() {
expect(
" |x>[\n* A\n* B]\n"
).markupToBecome(
" <tw-hook name=\"x\" title=\"Hook: ?x\"><br><ul><li>A</li><li>B</li></ul></tw-hook><br>"
);
});
it("(unlike Markdown) allows nested lists by the addition of more consecutive *'s", function() {
expect(
"* A\n** B\n** C\n* D"
......@@ -141,6 +148,13 @@ describe("list markup", function() {
"<ol><li>A</li></ol>B"
);
});
xit("work inside hooks", function() {
expect(
" |x>[\n0. A\n0. B]\n"
).markupToBecome(
" <tw-hook name=\"x\" title=\"Hook: ?x\"><br><ol><li>A</li><li>B</li></ol></tw-hook><br>"
);
});
it("(unlike Markdown) allows nested lists by the addition of more consecutive *'s", function() {
expect(
"0. A\n0.0. B\n0.0. C\n0. D"
......
......@@ -152,10 +152,11 @@ beforeEach(function() {
jasmine.addMatchers({
markupToBecome: Object.bind(Object,{
compare: function(a,e) {
if ((runPassage(a).html() || '') === e) {
var result = (runPassage(a).html() || '');
if (result === e) {
return { pass: true, message: "Expected markup '" + a + "' not to become '" + e + "'" };
} else {
return { pass: false, message: "Expected markup '" + a + "' to become '" + e + "'" };
return { pass: false, message: "Expected markup '" + a + "' to become '" + e + "', not '" + result + "'" };
}
}
}),
......
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