From 965eae5f453349aed94791eb0d93fabaabf1e2fb Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 10 Oct 2022 18:26:31 -0700 Subject: [PATCH] add spec for stateDB addStyleClass --- .../mermaid/src/diagrams/state/stateDb.spec.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 packages/mermaid/src/diagrams/state/stateDb.spec.js diff --git a/packages/mermaid/src/diagrams/state/stateDb.spec.js b/packages/mermaid/src/diagrams/state/stateDb.spec.js new file mode 100644 index 000000000..786c122aa --- /dev/null +++ b/packages/mermaid/src/diagrams/state/stateDb.spec.js @@ -0,0 +1,17 @@ +import stateDb from './stateDb'; + +describe('stateDb', () => { + describe('addStyleClass', () => { + it('is added to the list of style classes', () => { + const newStyleClassId = 'newStyleClass'; + const newStyleClassAttribs = 'font-weight:bold, border:blue;'; + + stateDb.addStyleClass(newStyleClassId, newStyleClassAttribs); + const styleClasses = stateDb.getClasses(); + expect(styleClasses[newStyleClassId].id).toEqual(newStyleClassId); + expect(styleClasses[newStyleClassId].styles.length).toEqual(2); + expect(styleClasses[newStyleClassId].styles[0]).toEqual('font-weight:bold'); + expect(styleClasses[newStyleClassId].styles[1]).toEqual('border:blue'); + }); + }); +});