Skip to content

Commit

Permalink
adds tests for line styles
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed Aug 29, 2021
1 parent 1d0e38e commit 7b72373
Show file tree
Hide file tree
Showing 17 changed files with 1,393 additions and 978 deletions.
1 change: 0 additions & 1 deletion .npmignore
Expand Up @@ -52,7 +52,6 @@ src/buildjs/
src/machines/
src/site/

dist/jssm.es5.iife.js
dist/jssm.es5.iife.nonmin.js
dist/jssm.es5.cjs.nonmin.js
dist/es6/jssm-dot.nonmin.js
2 changes: 1 addition & 1 deletion dist/es6/jssm-dot.js

Large diffs are not rendered by default.

768 changes: 446 additions & 322 deletions dist/es6/jssm-dot.nonmin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/es6/version.js
@@ -1,2 +1,2 @@
const version = "5.36.0";
const version = "5.36.2";
export { version };
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

756 changes: 440 additions & 316 deletions dist/jssm.es5.cjs.nonmin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jssm.es5.iife.js

Large diffs are not rendered by default.

756 changes: 440 additions & 316 deletions dist/jssm.es5.iife.nonmin.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/docs/assets/css/main.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/docs/modules.html
Expand Up @@ -132,7 +132,7 @@ <h3><span class="tsd-flag ts-flagConst">Const</span> seq</h3>
<section class="tsd-panel tsd-member tsd-kind-variable">
<a name="version" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> version</h3>
<div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &quot;5.36.0&quot;</span></div>
<div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = &quot;5.36.2&quot;</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in version.ts:2</li>
Expand Down
10 changes: 3 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "jssm",
"version": "5.36.0",
"version": "5.36.2",
"engines": {
"node": ">=10.0.0"
},
Expand Down
4 changes: 4 additions & 0 deletions src/ts/jssm-dot.peg
Expand Up @@ -521,8 +521,12 @@ ArrowItem
SingleEdgeColor "single edge color"
= WS? "edge_color" WS? ":" WS? value:Color WS? ";" WS? { return {key:'single_edge_color', value:value}; }

TransitionLineStyle "transition line style"
= WS? "linestyle" WS? ":" WS? value:LineStyle WS? ";" WS? { return {key:'transition_line_style', value:value}; }

ArrowItems
= SingleEdgeColor
/ TransitionLineStyle
/ ArrowItem+

ArrowDesc
Expand Down
8 changes: 4 additions & 4 deletions src/ts/tests/constants.spec.ts
Expand Up @@ -48,9 +48,9 @@ const NamedColors = ["AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure",



const Themes = ["default", "ocean", "none", "modern"];

const FlowDirections = ['up','down','left','right'];
const Themes = ['default', 'ocean', 'none', 'modern'],
FlowDirections = ['up','down','left','right'],
LineStyles = ['solid', 'dotted', 'dashed'];



Expand Down Expand Up @@ -95,4 +95,4 @@ describe('Constants test lists', () => {



export { NamedColors, Shapes, Themes, FlowDirections };
export { NamedColors, Shapes, Themes, FlowDirections, LineStyles };
2 changes: 1 addition & 1 deletion src/ts/tests/seq.stoch.ts
Expand Up @@ -3,7 +3,7 @@ import * as assert from 'assert';
import * as fc from 'fast-check';
import * as jssm from '../jssm';

const rand_cap = 100_000;
const rand_cap = 10_000;



Expand Down
51 changes: 47 additions & 4 deletions src/ts/tests/state_style.spec.ts
@@ -1,5 +1,5 @@

import { Shapes } from './constants.spec';
import { Shapes, LineStyles } from './constants.spec';

import { sm } from '../jssm';

Expand All @@ -9,29 +9,72 @@ import { sm } from '../jssm';

describe('State style', () => {



Shapes.map(shape => {

describe(shape, () => {

test(`can set regular state to ${shape}`, () =>
expect( () => {
const _foo = sm`machine_name: bob; state: { shape: ${shape}; }; a-> b;`;
const _foo = sm`machine_name: bob; state: { shape: ${shape}; }; a->b;`;
}).not.toThrow() );

test(`can set start state to ${shape}`, () =>
expect( () => {
const _foo = sm`machine_name: bob; start_state: { shape: ${shape}; }; a-> b;`;
const _foo = sm`machine_name: bob; start_state: { shape: ${shape}; }; a->b;`;
}).not.toThrow() );

test(`can set end state to ${shape}`, () =>
expect( () => {
const _foo = sm`machine_name: bob; end_state: { shape: ${shape}; }; a-> b;`;
const _foo = sm`machine_name: bob; end_state: { shape: ${shape}; }; a->b;`;
}).not.toThrow() );

test(`can set specific state to ${shape}`, () =>
expect( () => {
const _foo = sm`machine_name: bob; a->b; state a: { shape: ${shape}; };`;
}).not.toThrow() );

});

});



LineStyles.map(linestyle => {

// TODO FIXME it turns out state: , start_state: , and end_state: are on vestigial productions. fix it

// test(`can set regular state border line style to ${linestyle}`, () =>
// expect( () => {
// const _foo = sm`machine_name: bob; state: { linestyle: ${linestyle}; }; a->b;`;
// }).not.toThrow() );

// test(`can set start state border line style to ${linestyle}`, () =>
// expect( () => {
// const _foo = sm`machine_name: bob; start_state: { linestyle: ${linestyle}; }; a->b;`;
// }).not.toThrow() );

// test(`can set end state border line style to ${linestyle}`, () =>
// expect( () => {
// const _foo = sm`machine_name: bob; end_state: { linestyle: ${linestyle}; }; a->b;`;
// }).not.toThrow() );

test(`can set specific state border line style to ${linestyle}`, () =>
expect( () => {
const _foo = sm`machine_name: bob; a->b; state a: { linestyle: ${linestyle}; }; `;
}).not.toThrow() );

test(`can set transition line style to ${linestyle}`, () =>
expect( () => {
const _foo = sm`machine_name: bob; a{ linestyle: ${linestyle}; }->b;`;
}).not.toThrow() );


})



});


Expand Down
2 changes: 1 addition & 1 deletion src/ts/version.ts
@@ -1,3 +1,3 @@

const version: string = "5.36.0";
const version: string = "5.36.2";
export { version };

0 comments on commit 7b72373

Please sign in to comment.