extwee 2.0.2 → 2.0.3
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 +1 -1
- package/src/HTMLWriter.js +8 -4
- package/src/Story.js +31 -2
- package/test/CLI/test2.html +2 -2
- package/test/HTMLWriter/creator.html +2 -2
- package/test/HTMLWriter/test11.html +3 -3
- package/test/HTMLWriter/test2.html +1 -1
- package/test/HTMLWriter/test3.html +1 -1
- package/test/HTMLWriter/test4.html +2 -2
- package/test/HTMLWriter/test6.html +2 -2
- package/test/Roundtrip/round.html +2 -2
- package/test/Story.test.js +172 -85
- package/test/TweeWriter/test1.twee +1 -1
- package/test/TweeWriter/test5.twee +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
|
-
<title>
|
|
5
|
+
<title>Example1</title>
|
|
6
6
|
<style title="Twine CSS">@-webkit-keyframes appear{0%{opacity:0}to{opacity:1}}@keyframes appear{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fade-in-out{0%,to{opacity:0}50%{opacity:1}}@keyframes fade-in-out{0%,to{opacity:0}50%{opacity:1}}@-webkit-keyframes rumble{50%{-webkit-transform:translateY(-0.2em);transform:translateY(-0.2em)}}@keyframes rumble{50%{-webkit-transform:translateY(-0.2em);transform:translateY(-0.2em)}}@-webkit-keyframes shudder{50%{-webkit-transform:translateX(0.2em);transform:translateX(0.2em)}}@keyframes shudder{50%{-webkit-transform:translateX(0.2em);transform:translateX(0.2em)}}@-webkit-keyframes box-flash{0%{background-color:white;color:white}}@keyframes box-flash{0%{background-color:white;color:white}}@-webkit-keyframes pulse{0%{-webkit-transform:scale(0, 0);transform:scale(0, 0)}20%{-webkit-transform:scale(1.2, 1.2);transform:scale(1.2, 1.2)}40%{-webkit-transform:scale(0.9, 0.9);transform:scale(0.9, 0.9)}60%{-webkit-transform:scale(1.05, 1.05);transform:scale(1.05, 1.05)}80%{-webkit-transform:scale(0.925, 0.925);transform:scale(0.925, 0.925)}to{-webkit-transform:scale(1, 1);transform:scale(1, 1)}}@keyframes pulse{0%{-webkit-transform:scale(0, 0);transform:scale(0, 0)}20%{-webkit-transform:scale(1.2, 1.2);transform:scale(1.2, 1.2)}40%{-webkit-transform:scale(0.9, 0.9);transform:scale(0.9, 0.9)}60%{-webkit-transform:scale(1.05, 1.05);transform:scale(1.05, 1.05)}80%{-webkit-transform:scale(0.925, 0.925);transform:scale(0.925, 0.925)}to{-webkit-transform:scale(1, 1);transform:scale(1, 1)}}@-webkit-keyframes shudder-in{0%, to{-webkit-transform:translateX(0em);transform:translateX(0em)}5%, 25%, 45%{-webkit-transform:translateX(-1em);transform:translateX(-1em)}15%, 35%, 55%{-webkit-transform:translateX(1em);transform:translateX(1em)}65%{-webkit-transform:translateX(-0.6em);transform:translateX(-0.6em)}75%{-webkit-transform:translateX(0.6em);transform:translateX(0.6em)}85%{-webkit-transform:translateX(-0.2em);transform:translateX(-0.2em)}95%{-webkit-transform:translateX(0.2em);transform:translateX(0.2em)}}@keyframes shudder-in{0%, to{-webkit-transform:translateX(0em);transform:translateX(0em)}5%, 25%, 45%{-webkit-transform:translateX(-1em);transform:translateX(-1em)}15%, 35%, 55%{-webkit-transform:translateX(1em);transform:translateX(1em)}65%{-webkit-transform:translateX(-0.6em);transform:translateX(-0.6em)}75%{-webkit-transform:translateX(0.6em);transform:translateX(0.6em)}85%{-webkit-transform:translateX(-0.2em);transform:translateX(-0.2em)}95%{-webkit-transform:translateX(0.2em);transform:translateX(0.2em)}}@-webkit-keyframes rumble-in{0%, to{-webkit-transform:translateY(0em);transform:translateY(0em)}5%, 25%, 45%{-webkit-transform:translateY(-1em);transform:translateY(-1em)}15%, 35%, 55%{-webkit-transform:translateY(1em);transform:translateY(1em)}65%{-webkit-transform:translateY(-0.6em);transform:translateY(-0.6em)}75%{-webkit-transform:translateY(0.6em);transform:translateY(0.6em)}85%{-webkit-transform:translateY(-0.2em);transform:translateY(-0.2em)}95%{-webkit-transform:translateY(0.2em);transform:translateY(0.2em)}}@keyframes rumble-in{0%, to{-webkit-transform:translateY(0em);transform:translateY(0em)}5%, 25%, 45%{-webkit-transform:translateY(-1em);transform:translateY(-1em)}15%, 35%, 55%{-webkit-transform:translateY(1em);transform:translateY(1em)}65%{-webkit-transform:translateY(-0.6em);transform:translateY(-0.6em)}75%{-webkit-transform:translateY(0.6em);transform:translateY(0.6em)}85%{-webkit-transform:translateY(-0.2em);transform:translateY(-0.2em)}95%{-webkit-transform:translateY(0.2em);transform:translateY(0.2em)}}@-webkit-keyframes slide-right{0%{-webkit-transform:translateX(-100vw);transform:translateX(-100vw)}}@keyframes slide-right{0%{-webkit-transform:translateX(-100vw);transform:translateX(-100vw)}}@-webkit-keyframes slide-left{0%{-webkit-transform:translateX(100vw);transform:translateX(100vw)}}@keyframes slide-left{0%{-webkit-transform:translateX(100vw);transform:translateX(100vw)}}@-webkit-keyframes slide-up{0%{-webkit-transform:translateY(100vh);transform:translateY(100vh)}}@keyframes slide-up{0%{-webkit-transform:translateY(100vh);transform:translateY(100vh)}}@-webkit-keyframes slide-down{0%{-webkit-transform:translateY(-100vh);transform:translateY(-100vh)}}@keyframes slide-down{0%{-webkit-transform:translateY(-100vh);transform:translateY(-100vh)}}@-webkit-keyframes flicker{0%,29%,31%,63%,65%,77%,79%,86%,88%,91%,93%{opacity:0}30%{opacity:0.2}64%{opacity:0.4}78%{opacity:0.6}87%{opacity:0.8}92%, to{opacity:1}}@keyframes flicker{0%,29%,31%,63%,65%,77%,79%,86%,88%,91%,93%{opacity:0}30%{opacity:0.2}64%{opacity:0.4}78%{opacity:0.6}87%{opacity:0.8}92%, to{opacity:1}}.debug-mode tw-expression[type=hookref]{background-color:rgba(115,123,140,0.15)}.debug-mode tw-expression[type=hookref]::after{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:"?" attr(name)}.debug-mode tw-expression[type=variable]{background-color:rgba(140,128,115,0.15)}.debug-mode tw-expression[type=variable]::after{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:"$" attr(name)}.debug-mode tw-expression[type=tempVariable]{background-color:rgba(140,128,115,0.15)}.debug-mode tw-expression[type=tempVariable]::after{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:"_" attr(name)}.debug-mode tw-expression[type=macro]:nth-of-type(4n+0){background-color:rgba(136,153,102,0.15)}.debug-mode tw-expression[type=macro]:nth-of-type(2n+1){background-color:rgba(102,153,102,0.15)}.debug-mode tw-expression[type=macro]:nth-of-type(4n+2){background-color:rgba(102,153,136,0.15)}.debug-mode tw-expression[type=macro][name="display"]{background-color:rgba(0,170,255,0.1) !important}.debug-mode tw-expression[type=macro][name="if"],.debug-mode tw-expression[type=macro][name="if"]+tw-hook:not([name]),.debug-mode tw-expression[type=macro][name="unless"],.debug-mode tw-expression[type=macro][name="unless"]+tw-hook:not([name]),.debug-mode tw-expression[type=macro][name="elseif"],.debug-mode tw-expression[type=macro][name="elseif"]+tw-hook:not([name]),.debug-mode tw-expression[type=macro][name="else"],.debug-mode tw-expression[type=macro][name="else"]+tw-hook:not([name]){background-color:rgba(0,255,0,0.1) !important}.debug-mode tw-expression[type=macro].false{background-color:rgba(255,0,0,0.2) !important}.debug-mode tw-expression[type=macro].false+tw-hook:not([name]){display:none}.debug-mode tw-expression[type=macro][name="a"],.debug-mode tw-expression[type=macro][name="array"],.debug-mode tw-expression[type=macro][name="datamap"],.debug-mode tw-expression[type=macro][name="dataset"],.debug-mode tw-expression[type=macro][name="colour"],.debug-mode tw-expression[type=macro][name="color"],.debug-mode tw-expression[type=macro][name="num"],.debug-mode tw-expression[type=macro][name="number"],.debug-mode tw-expression[type=macro][name="text"],.debug-mode tw-expression[type=macro][name="print"]{background-color:rgba(255,255,0,0.2) !important}.debug-mode tw-expression[type=macro][name="put"],.debug-mode tw-expression[type=macro][name="set"]{background-color:rgba(255,128,0,0.2) !important}.debug-mode tw-expression[type=macro][name="script"]{background-color:rgba(255,191,0,0.2) !important}.debug-mode tw-expression[type=macro][name="style"]{background-color:rgba(185,198,198,0.2) !important}.debug-mode tw-expression[type=macro][name^="link"],.debug-mode tw-expression[type=macro][name^="click"],.debug-mode tw-expression[type=macro][name^="mouseover"],.debug-mode tw-expression[type=macro][name^="mouseout"]{background-color:rgba(128,223,32,0.2) !important}.debug-mode tw-expression[type=macro][name^="replace"],.debug-mode tw-expression[type=macro][name^="prepend"],.debug-mode tw-expression[type=macro][name^="append"],.debug-mode tw-expression[type=macro][name^="remove"]{background-color:rgba(223,96,32,0.2) !important}.debug-mode tw-expression[type=macro][name="live"]{background-color:rgba(32,96,223,0.2) !important}.debug-mode tw-expression[type=macro]::before{content:"(" attr(name) ":)";padding:0 0.5rem;font-size:1rem;vertical-align:middle;line-height:normal;background-color:inherit;border:1px solid rgba(255,255,255,0.5)}.debug-mode tw-hook{background-color:rgba(0,85,255,0.1) !important}.debug-mode tw-hook::before{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:"["}.debug-mode tw-hook::after{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:"]"}.debug-mode tw-hook[name]::after{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:"]<" attr(name) "|"}.debug-mode tw-pseudo-hook{background-color:rgba(255,170,0,0.1) !important}.debug-mode tw-collapsed::before{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:"{"}.debug-mode tw-collapsed::after{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:"}"}.debug-mode tw-verbatim::before,.debug-mode tw-verbatim::after{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:"`"}.debug-mode tw-align[style*="text-align: center"]{background:linear-gradient(to right, rgba(255,204,189,0) 0%, rgba(255,204,189,0.25) 50%, rgba(255,204,189,0) 100%)}.debug-mode tw-align[style*="text-align: left"]{background:linear-gradient(to right, rgba(255,204,189,0.25) 0%, rgba(255,204,189,0) 100%)}.debug-mode tw-align[style*="text-align: right"]{background:linear-gradient(to right, rgba(255,204,189,0) 0%, rgba(255,204,189,0.25) 100%)}.debug-mode tw-column{background-color:rgba(189,228,255,0.2)}.debug-mode tw-enchantment{animation:enchantment 0.5s infinite;-webkit-animation:enchantment 0.5s infinite;border:1px solid}.debug-mode tw-link::after,.debug-mode tw-broken-link::after{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:attr(passage-name)}.debug-mode tw-include{background-color:rgba(204,128,51,0.1)}.debug-mode tw-include::before{font-size:0.8rem;padding-left:0.2rem;padding-right:0.2rem;vertical-align:top;content:attr(type) ' "' attr(title) '"'}@keyframes enchantment{0%,to{border-color:#ffb366}50%{border-color:#6fc}}@-webkit-keyframes enchantment{0%,to{border-color:#ffb366}50%{border-color:#6fc}}tw-debugger{position:fixed;box-sizing:border-box;bottom:0;right:0;z-index:999999;min-width:10em;min-height:1em;padding:1em;font-size:1.25em;font-family:sans-serif;border-left:solid #000 2px;border-top:solid #000 2px;border-top-left-radius:.5em;background:#fff;opacity:1}tw-debugger select{margin-right:1em;width:12em}tw-debugger button{border-radius:3px;border:solid #999 1px;margin:auto 4px;background-color:#fff;font-size:inherit}tw-debugger button.enabled{background-color:#eee;box-shadow:inset #ddd 3px 5px 0.5em}tw-debugger .variables{display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;-webkit-box-direction:normal;-webkit-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;position:absolute;bottom:100%;left:-2px;right:0;padding:1em;max-height:40vh;overflow-y:scroll;overflow-x:hidden;z-index:999998;background:#fff;border:inherit;border-top-left-radius:.5em;border-bottom-left-radius:.5em;font-size:0.8em}tw-debugger .variables:empty,tw-debugger .variables[hidden]{display:none}tw-debugger .variables .variable-row{display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;-webkit-box-direction:normal;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row;flex-shrink:0}tw-debugger .variables .variable-row:nth-child(2n){background:#EEE}tw-debugger .variables .variable-name{display:inline-block;width:50%}tw-debugger .variables .variable-name::before{content:"$"}tw-debugger .variables .variable-name.temporary::before{content:"_"}tw-debugger .variables .variable-name .temporary-variable-scope{opacity:0.8;font-size:0.75em}tw-debugger .variables .variable-name .temporary-variable-scope::before{content:" in "}tw-debugger .variables .variable-value{display:inline-block;width:50%}tw-link,.link,tw-icon,.enchantment-clickblock{cursor:pointer}tw-link,.enchantment-link{color:#4169E1;font-weight:bold;text-decoration:none;transition:color 0.2s ease-in-out}tw-enchantment[style^="color"] tw-link:not(:hover),tw-enchantment[style*=" color"] tw-link:not(:hover),tw-enchantment[style^="color"] .enchantment-link:not(:hover),tw-enchantment[style*=" color"] .enchantment-link:not(:hover){color:inherit}tw-link:hover,.enchantment-link:hover{color:#00bfff}tw-link:active,.enchantment-link:active{color:#DD4B39}.visited{color:#6941e1}tw-enchantment[style^="color"] .visited:not(:hover),tw-enchantment[style*=" color"] .visited:not(:hover){color:inherit}.visited:hover{color:#E3E}tw-broken-link{color:#993333;border-bottom:2px solid #993333;cursor:not-allowed}tw-enchantment[style^="color"] tw-broken-link:not(:hover),tw-enchantment[style*=" color"] tw-broken-link:not(:hover){color:inherit}.enchantment-mouseover{border-bottom:1px dashed #666}.enchantment-mouseout{border:rgba(64,149,191,0.25) 1px solid}.enchantment-mouseout:hover{background-color:rgba(64,149,191,0.25);border:transparent 1px solid;border-radius:0.2em}.enchantment-clickblock{box-shadow:inset 0 0 0 0.5vmax;display:block;color:rgba(65,105,225,0.5);transition:color 0.2s ease-in-out}.enchantment-clickblock:hover{color:rgba(0,191,255,0.5)}.enchantment-clickblock:active{color:rgba(222,78,59,0.5)}html{margin:0;height:100%;overflow-x:hidden}*,:before,:after{position:relative;box-sizing:inherit}body{margin:0;height:100%}tw-storydata{display:none}tw-story{display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;-webkit-box-direction:normal;-webkit-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;font:100% Georgia, serif;box-sizing:border-box;width:100%;min-height:100%;font-size:1.5em;line-height:1.5em;padding:5% 20%;margin:0;overflow:hidden;background-color:#000;color:#fff}tw-passage{display:block}br+br{display:block;height:0;margin:0.8ex 0}tw-sidebar{left:-5em;width:3em;position:absolute;text-align:center;display:block}tw-icon{display:block;margin:0.5em 0;opacity:0.2;font-size:2.75em}tw-icon:hover{opacity:0.4}tw-hook:empty,tw-expression:empty{display:none}tw-error{display:inline-block;border-radius:0.2em;padding:0.2em;font-size:1rem;cursor:help}tw-error.error{background-color:rgba(223,58,190,0.4);color:#fff}tw-error.warning{background-color:rgba(223,140,58,0.4);color:#fff;display:none}.debug-mode tw-error.warning{display:inline}tw-error-explanation{display:block;font-size:0.8rem;line-height:1rem}tw-error-explanation-button{cursor:pointer;line-height:0em;border-radius:1px;border:1px solid black;font-size:0.8rem;margin:0 0.4rem;opacity:0.5}tw-error-explanation-button .folddown-arrowhead{display:inline-block}tw-notifier{border-radius:0.2em;padding:0.2em;font-size:1rem;background-color:rgba(223,182,58,0.4);display:none}.debug-mode tw-notifier{display:inline}tw-notifier::before{content:attr(message)}tw-colour{border:1px solid black;display:inline-block;width:1em;height:1em}select{background-color:transparent;font:inherit;border-style:solid;padding:2px}select:not([disabled]){color:inherit}h1{font-size:3em}h2{font-size:2.25em}h3{font-size:1.75em}h1,h2,h3,h4,h5,h6{line-height:1em;margin:0.3em 0 0.6em 0}pre{font-size:1rem}small{font-size:70%}big{font-size:120%}mark{color:rgba(0,0,0,0.6);background-color:#ff9}ins{color:rgba(0,0,0,0.6);background-color:rgba(255,242,204,0.5);border-radius:0.5em;box-shadow:0em 0em 0.2em #ffe699;text-decoration:none}center{text-align:center;margin:0 auto;width:60%}blink{text-decoration:none;animation:fade-in-out 1s steps(1, end) infinite alternate;-webkit-animation:fade-in-out 1s steps(1, end) infinite alternate}tw-align{display:block}tw-columns{display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;-webkit-box-direction:normal;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;-moz-justify-content:space-between;justify-content:space-between}tw-outline{color:white;text-shadow:-1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000}tw-shadow{text-shadow:0.08em 0.08em 0.08em #000}tw-emboss{text-shadow:0.08em 0.08em 0em #000;color:white}tw-condense{letter-spacing:-0.08em}tw-expand{letter-spacing:0.1em}tw-blur{color:transparent;text-shadow:0em 0em 0.08em #000}tw-blurrier{color:transparent;text-shadow:0em 0em 0.2em #000}tw-blurrier::selection{background-color:transparent;color:transparent}tw-blurrier::-moz-selection{background-color:transparent;color:transparent}tw-smear{color:transparent;text-shadow:0em 0em 0.02em rgba(0,0,0,0.75),-0.2em 0em 0.5em rgba(0,0,0,0.5),0.2em 0em 0.5em rgba(0,0,0,0.5)}tw-mirror{display:inline-block;transform:scaleX(-1);-webkit-transform:scaleX(-1)}tw-upside-down{display:inline-block;transform:scaleY(-1);-webkit-transform:scaleY(-1)}tw-fade-in-out{text-decoration:none;animation:fade-in-out 2s ease-in-out infinite alternate;-webkit-animation:fade-in-out 2s ease-in-out infinite alternate}tw-rumble{-webkit-animation:rumble linear 0.1s 0s infinite;animation:rumble linear 0.1s 0s infinite;display:inline-block}tw-shudder{-webkit-animation:shudder linear 0.1s 0s infinite;animation:shudder linear 0.1s 0s infinite;display:inline-block}tw-shudder-in{animation:shudder-in 1s ease-out;-webkit-animation:shudder-in 1s ease-out}.transition-in{-webkit-animation:appear 0ms step-start;animation:appear 0ms step-start}.transition-out{-webkit-animation:appear 0ms step-end;animation:appear 0ms step-end}[data-t8n^=dissolve].transition-in{-webkit-animation:appear .8s;animation:appear .8s}[data-t8n^=dissolve].transition-out{-webkit-animation:appear .8s reverse;animation:appear .8s reverse}[data-t8n^=shudder].transition-in{display:inline-block;-webkit-animation:shudder-in .8s;animation:shudder-in .8s}[data-t8n^=shudder].transition-out{display:inline-block;-webkit-animation:shudder-in .8s reverse;animation:shudder-in .8s reverse}[data-t8n^=rumble].transition-in{display:inline-block;-webkit-animation:rumble-in .8s;animation:rumble-in .8s}[data-t8n^=rumble].transition-out{display:inline-block;-webkit-animation:rumble-in .8s reverse;animation:rumble-in .8s reverse}[data-t8n^=boxflash].transition-in{-webkit-animation:box-flash .8s;animation:box-flash .8s}[data-t8n^=pulse].transition-in{-webkit-animation:pulse .8s;animation:pulse .8s;display:inline-block}[data-t8n^=pulse].transition-out{-webkit-animation:pulse .8s reverse;animation:pulse .8s reverse;display:inline-block}[data-t8n^=slideleft].transition-in{-webkit-animation:slide-left .8s;animation:slide-left .8s;display:inline-block}[data-t8n^=slideleft].transition-out{-webkit-animation:slide-right .8s reverse;animation:slide-right .8s reverse;display:inline-block}[data-t8n^=slideright].transition-in{-webkit-animation:slide-right .8s;animation:slide-right .8s;display:inline-block}[data-t8n^=slideright].transition-out{-webkit-animation:slide-left .8s reverse;animation:slide-left .8s reverse;display:inline-block}[data-t8n^=slideup].transition-in{-webkit-animation:slide-up .8s;animation:slide-up .8s;display:inline-block}[data-t8n^=slideup].transition-out{-webkit-animation:slide-down .8s reverse;animation:slide-down .8s reverse;display:inline-block}[data-t8n^=slidedown].transition-in{-webkit-animation:slide-down .8s;animation:slide-down .8s;display:inline-block}[data-t8n^=slidedown].transition-out{-webkit-animation:slide-up .8s reverse;animation:slide-up .8s reverse;display:inline-block}[data-t8n^=flicker].transition-in{-webkit-animation:flicker .8s;animation:flicker .8s}[data-t8n^=flicker].transition-out{-webkit-animation:flicker .8s reverse;animation:flicker .8s reverse}[data-t8n$=fast]{animation-duration:.4s;-webkit-animation-duration:.4s}[data-t8n$=slow]{animation-duration:1.6s;-webkit-animation-duration:1.6s}
|
|
7
7
|
</style>
|
|
8
8
|
</head>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
<tw-story></tw-story>
|
|
13
13
|
|
|
14
|
-
<tw-storydata name="Example1" startnode="4" creator="extwee" creator-version="2.0.
|
|
14
|
+
<tw-storydata name="Example1" startnode="4" creator="extwee" creator-version="2.0.3" ifid="D37AFDA9-0C6C-434C-94F4-210A4E27AC4F" zoom="0" format="Harlowe" format-version="3.0.2" options hidden>
|
|
15
15
|
<style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>
|
|
16
16
|
<script role="script" id="twine-user-script" type="text/twine-javascript"></script>
|
|
17
17
|
<tw-passagedata pid="1" name="StoryTitle">Example1</tw-passagedata>
|
package/test/Story.test.js
CHANGED
|
@@ -6,142 +6,202 @@ import FileReader from '../src/FileReader.js';
|
|
|
6
6
|
// These are used as the 'creator' and 'creator-version'.
|
|
7
7
|
const { name, version } = JSON.parse(FileReader.read('package.json'));
|
|
8
8
|
|
|
9
|
-
describe('Story',
|
|
10
|
-
describe('#constructor()',
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
describe('Story', () => {
|
|
10
|
+
describe('#constructor()', () => {
|
|
11
|
+
let s = null;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
s = new Story();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('Should have extwee name', () => {
|
|
13
18
|
expect(s.creator).toBe(name);
|
|
14
19
|
});
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
const s = new Story();
|
|
21
|
+
it('Should have extwee version', () => {
|
|
18
22
|
expect(s.creatorVersion).toBe(version);
|
|
19
23
|
});
|
|
20
24
|
});
|
|
21
25
|
|
|
22
|
-
describe('creator',
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
describe('creator', () => {
|
|
27
|
+
let s = null;
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
s = new Story();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('Set using String', () => {
|
|
25
34
|
s.creator = 'New';
|
|
26
35
|
expect(s.creator).toBe('New');
|
|
27
36
|
});
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
const s = new Story();
|
|
38
|
+
it('Should throw error if not String', () => {
|
|
31
39
|
expect(() => {
|
|
32
40
|
s.creator = 1;
|
|
33
41
|
}).toThrow();
|
|
34
42
|
});
|
|
35
43
|
});
|
|
36
44
|
|
|
37
|
-
describe('creatorVersion',
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
describe('creatorVersion', () => {
|
|
46
|
+
let s = null;
|
|
47
|
+
|
|
48
|
+
beforeEach(() => {
|
|
49
|
+
s = new Story();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('Set using String', () => {
|
|
40
53
|
s.creatorVersion = 'New';
|
|
41
54
|
expect(s.creatorVersion).toBe('New');
|
|
42
55
|
});
|
|
43
56
|
|
|
44
|
-
|
|
45
|
-
const s = new Story();
|
|
57
|
+
it('Should throw error if not String', () => {
|
|
46
58
|
expect(() => {
|
|
47
59
|
s.creatorVersion = 1;
|
|
48
60
|
}).toThrow();
|
|
49
61
|
});
|
|
50
62
|
});
|
|
51
63
|
|
|
52
|
-
describe('IFID',
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
describe('IFID', () => {
|
|
65
|
+
let s = null;
|
|
66
|
+
|
|
67
|
+
beforeEach(() => {
|
|
68
|
+
s = new Story();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('Set using String', () => {
|
|
55
72
|
s.IFID = 'New';
|
|
56
73
|
expect(s.IFID).toBe('New');
|
|
57
74
|
});
|
|
58
75
|
|
|
59
|
-
|
|
60
|
-
const s = new Story();
|
|
76
|
+
it('Should throw error if not String', () => {
|
|
61
77
|
expect(() => {
|
|
62
78
|
s.IFID = 1;
|
|
63
79
|
}).toThrow();
|
|
64
80
|
});
|
|
65
81
|
});
|
|
66
82
|
|
|
67
|
-
describe('format',
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
describe('format', () => {
|
|
84
|
+
let s = null;
|
|
85
|
+
|
|
86
|
+
beforeEach(() => {
|
|
87
|
+
s = new Story();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('Set using String', () => {
|
|
70
91
|
s.format = 'New';
|
|
71
92
|
expect(s.format).toBe('New');
|
|
72
93
|
});
|
|
73
94
|
|
|
74
|
-
|
|
75
|
-
const s = new Story();
|
|
95
|
+
it('Should throw error if not String', () => {
|
|
76
96
|
expect(() => {
|
|
77
97
|
s.format = 1;
|
|
78
98
|
}).toThrow();
|
|
79
99
|
});
|
|
80
100
|
});
|
|
81
101
|
|
|
82
|
-
describe('formatVersion',
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
describe('formatVersion', () => {
|
|
103
|
+
let s = null;
|
|
104
|
+
|
|
105
|
+
beforeEach(() => {
|
|
106
|
+
s = new Story();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('Set using String', () => {
|
|
85
110
|
s.formatVersion = 'New';
|
|
86
111
|
expect(s.formatVersion).toBe('New');
|
|
87
112
|
});
|
|
88
113
|
|
|
89
|
-
|
|
90
|
-
const s = new Story();
|
|
114
|
+
it('Should throw error if not String', () => {
|
|
91
115
|
expect(() => {
|
|
92
116
|
s.formatVersion = 1;
|
|
93
117
|
}).toThrow();
|
|
94
118
|
});
|
|
95
119
|
});
|
|
96
120
|
|
|
97
|
-
describe('
|
|
98
|
-
|
|
99
|
-
|
|
121
|
+
describe('name', () => {
|
|
122
|
+
let s = null;
|
|
123
|
+
|
|
124
|
+
beforeEach(() => {
|
|
125
|
+
s = new Story();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('Set using String', () => {
|
|
129
|
+
s.name = 'New';
|
|
130
|
+
expect(s.name).toBe('New');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('Should throw error if not String', () => {
|
|
134
|
+
expect(() => {
|
|
135
|
+
s.name = 1;
|
|
136
|
+
}).toThrow();
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
describe('zoom', () => {
|
|
141
|
+
let s = null;
|
|
142
|
+
|
|
143
|
+
beforeEach(() => {
|
|
144
|
+
s = new Story();
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('Set using Number', () => {
|
|
100
148
|
s.zoom = 1.0;
|
|
101
149
|
expect(s.zoom).not.toBe(0);
|
|
102
150
|
});
|
|
103
151
|
|
|
104
|
-
|
|
105
|
-
const s = new Story();
|
|
152
|
+
it('Should throw error if not String', () => {
|
|
106
153
|
expect(() => {
|
|
107
154
|
s.zoom = null;
|
|
108
155
|
}).toThrow();
|
|
109
156
|
});
|
|
110
157
|
});
|
|
111
158
|
|
|
112
|
-
describe('metadata',
|
|
113
|
-
|
|
114
|
-
|
|
159
|
+
describe('metadata', () => {
|
|
160
|
+
let s = null;
|
|
161
|
+
|
|
162
|
+
beforeEach(() => {
|
|
163
|
+
s = new Story();
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('Set metadata', () => {
|
|
115
167
|
s.metadata = {};
|
|
116
168
|
expect(s.metadata).not.toBe(null);
|
|
117
169
|
});
|
|
118
170
|
|
|
119
|
-
|
|
120
|
-
const s = new Story();
|
|
171
|
+
it('Should throw error if not object', () => {
|
|
121
172
|
expect(() => {
|
|
122
173
|
s.metadata = 1;
|
|
123
174
|
}).toThrow();
|
|
124
175
|
});
|
|
125
176
|
});
|
|
126
177
|
|
|
127
|
-
describe('start',
|
|
128
|
-
|
|
129
|
-
|
|
178
|
+
describe('start', () => {
|
|
179
|
+
let s = null;
|
|
180
|
+
|
|
181
|
+
beforeEach(() => {
|
|
182
|
+
s = new Story();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('Set start', () => {
|
|
130
186
|
s.start = 'Start';
|
|
131
187
|
expect(s.start).not.toBe('');
|
|
132
188
|
});
|
|
133
189
|
|
|
134
|
-
|
|
135
|
-
const s = new Story();
|
|
190
|
+
it('Should throw error if not String', () => {
|
|
136
191
|
expect(() => {
|
|
137
192
|
s.start = 1;
|
|
138
193
|
}).toThrow();
|
|
139
194
|
});
|
|
140
195
|
});
|
|
141
196
|
|
|
142
|
-
describe('tagColors',
|
|
143
|
-
|
|
144
|
-
|
|
197
|
+
describe('tagColors', () => {
|
|
198
|
+
let s = null;
|
|
199
|
+
|
|
200
|
+
beforeEach(() => {
|
|
201
|
+
s = new Story();
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('Set tagColors', () => {
|
|
145
205
|
s.tagColors = {
|
|
146
206
|
bar: 'green'
|
|
147
207
|
};
|
|
@@ -149,31 +209,33 @@ describe('Story', function () {
|
|
|
149
209
|
expect(count).toBe(1);
|
|
150
210
|
});
|
|
151
211
|
|
|
152
|
-
|
|
153
|
-
const s = new Story();
|
|
212
|
+
it('Should throw error if not object', () => {
|
|
154
213
|
expect(() => {
|
|
155
214
|
s.tagColors = null;
|
|
156
215
|
}).toThrow();
|
|
157
216
|
});
|
|
158
217
|
});
|
|
159
218
|
|
|
160
|
-
describe('addPassage()',
|
|
161
|
-
|
|
162
|
-
|
|
219
|
+
describe('addPassage()', () => {
|
|
220
|
+
let s = null;
|
|
221
|
+
|
|
222
|
+
beforeEach(() => {
|
|
223
|
+
s = new Story();
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it('addPassage() - should increase size', () => {
|
|
163
227
|
const p = new Passage();
|
|
164
228
|
s.addPassage(p);
|
|
165
229
|
expect(s.size()).toBe(1);
|
|
166
230
|
});
|
|
167
231
|
|
|
168
|
-
|
|
169
|
-
const s = new Story();
|
|
232
|
+
it('addPassage() - should throw error if non-Passage', () => {
|
|
170
233
|
expect(() => {
|
|
171
234
|
s.addPassage(null);
|
|
172
235
|
}).toThrow();
|
|
173
236
|
});
|
|
174
237
|
|
|
175
|
-
|
|
176
|
-
const s = new Story();
|
|
238
|
+
it('addPassage() - should prevent passages with same name being added', () => {
|
|
177
239
|
const p = new Passage('A');
|
|
178
240
|
const p2 = new Passage('A');
|
|
179
241
|
s.addPassage(p);
|
|
@@ -182,9 +244,14 @@ describe('Story', function () {
|
|
|
182
244
|
});
|
|
183
245
|
});
|
|
184
246
|
|
|
185
|
-
describe('removePassage()',
|
|
186
|
-
|
|
187
|
-
|
|
247
|
+
describe('removePassage()', () => {
|
|
248
|
+
let s = null;
|
|
249
|
+
|
|
250
|
+
beforeEach(() => {
|
|
251
|
+
s = new Story();
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('removePassage() - should decrease size', () => {
|
|
188
255
|
s.addPassage(new Passage('Find'));
|
|
189
256
|
s.addPassage(new Passage('Find2'));
|
|
190
257
|
s.removePassage('Find');
|
|
@@ -192,9 +259,14 @@ describe('Story', function () {
|
|
|
192
259
|
});
|
|
193
260
|
});
|
|
194
261
|
|
|
195
|
-
describe('getPassagesByTag()',
|
|
196
|
-
|
|
197
|
-
|
|
262
|
+
describe('getPassagesByTag()', () => {
|
|
263
|
+
let s = null;
|
|
264
|
+
|
|
265
|
+
beforeEach(() => {
|
|
266
|
+
s = new Story();
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it('getPassagesByTag() - should find passages', () => {
|
|
198
270
|
const p = new Passage('Find', '', ['one']);
|
|
199
271
|
const p2 = new Passage('Find2', '', ['one']);
|
|
200
272
|
s.addPassage(p);
|
|
@@ -203,14 +275,12 @@ describe('Story', function () {
|
|
|
203
275
|
expect(ps).toHaveLength(2);
|
|
204
276
|
});
|
|
205
277
|
|
|
206
|
-
|
|
207
|
-
const s = new Story();
|
|
278
|
+
it('getPassagesByTag() - should find none if none in collection', () => {
|
|
208
279
|
const ps = s.getPassagesByTag('one');
|
|
209
280
|
expect(ps).toHaveLength(0);
|
|
210
281
|
});
|
|
211
282
|
|
|
212
|
-
|
|
213
|
-
const s = new Story();
|
|
283
|
+
it('getPassagesByTag() - should find none if no tags match search', () => {
|
|
214
284
|
const p = new Passage('Find', '', ['one']);
|
|
215
285
|
const p2 = new Passage('Find2', '', ['one']);
|
|
216
286
|
s.addPassage(p);
|
|
@@ -220,9 +290,14 @@ describe('Story', function () {
|
|
|
220
290
|
});
|
|
221
291
|
});
|
|
222
292
|
|
|
223
|
-
describe('getPassageByName()',
|
|
224
|
-
|
|
225
|
-
|
|
293
|
+
describe('getPassageByName()', () => {
|
|
294
|
+
let s = null;
|
|
295
|
+
|
|
296
|
+
beforeEach(() => {
|
|
297
|
+
s = new Story();
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
it('getPassageByName() - should get passage by name', () => {
|
|
226
301
|
const p = new Passage('Find');
|
|
227
302
|
s.addPassage(p);
|
|
228
303
|
const passage = s.getPassageByName('Find');
|
|
@@ -230,24 +305,33 @@ describe('Story', function () {
|
|
|
230
305
|
});
|
|
231
306
|
});
|
|
232
307
|
|
|
233
|
-
describe('getPassageByPID()',
|
|
234
|
-
|
|
235
|
-
|
|
308
|
+
describe('getPassageByPID()', () => {
|
|
309
|
+
let s = null;
|
|
310
|
+
|
|
311
|
+
beforeEach(() => {
|
|
312
|
+
s = new Story();
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it('getPassageByPID() - should get passage by PID', () => {
|
|
236
316
|
const p = new Passage('Find', '', [], {}, 12);
|
|
237
317
|
s.addPassage(p);
|
|
238
318
|
const passage = s.getPassageByPID(12);
|
|
239
319
|
expect(passage.name).toBe('Find');
|
|
240
320
|
});
|
|
241
321
|
|
|
242
|
-
|
|
243
|
-
const s = new Story();
|
|
322
|
+
it('getPassageByPID() - should return null if not found', () => {
|
|
244
323
|
expect(s.getPassageByPID(12)).toBe(null);
|
|
245
324
|
});
|
|
246
325
|
});
|
|
247
326
|
|
|
248
|
-
describe('forEach()',
|
|
249
|
-
|
|
250
|
-
|
|
327
|
+
describe('forEach()', () => {
|
|
328
|
+
let s = null;
|
|
329
|
+
|
|
330
|
+
beforeEach(() => {
|
|
331
|
+
s = new Story();
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('forEach() - should return if non-function', () => {
|
|
251
335
|
s.addPassage(new Passage('A'));
|
|
252
336
|
s.addPassage(new Passage('B'));
|
|
253
337
|
let passageNames = '';
|
|
@@ -257,18 +341,21 @@ describe('Story', function () {
|
|
|
257
341
|
expect(passageNames).toBe('AB');
|
|
258
342
|
});
|
|
259
343
|
|
|
260
|
-
|
|
261
|
-
const s = new Story();
|
|
344
|
+
it('forEach() - should throw error if non-function', () => {
|
|
262
345
|
expect(() => {
|
|
263
346
|
s.forEach(null);
|
|
264
347
|
}).toThrow();
|
|
265
348
|
});
|
|
266
349
|
});
|
|
267
350
|
|
|
268
|
-
describe('size()',
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
351
|
+
describe('size()', () => {
|
|
352
|
+
let s = null;
|
|
353
|
+
|
|
354
|
+
beforeEach(() => {
|
|
355
|
+
s = new Story();
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
it('size() - should report number of passages', () => {
|
|
272
359
|
// Create a Passage
|
|
273
360
|
const p = new Passage('');
|
|
274
361
|
// Test initial size
|