Skip to content

Commit

Permalink
Merge pull request #5625 from mermaid-js/fix/5624_ClassDirection
Browse files Browse the repository at this point in the history
fix(class): #5624 Reset direction to default in classDiagram
  • Loading branch information
sidharthv96 authored Jul 7, 2024
2 parents adf4351 + a80dd71 commit b263164
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/mermaid/src/diagrams/class/classDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const clear = function () {
functions.push(setupToolTips);
namespaces = new Map();
namespaceCounter = 0;
direction = 'TB';
commonClear();
};

Expand Down
11 changes: 11 additions & 0 deletions packages/mermaid/src/diagrams/class/classDiagram.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,17 @@ class C13["With Città foreign language"]
]
`);
});

it('should revert direction to default once direction is removed', () => {
parser.parse(`classDiagram
direction RL
class A`);
expect(classDb.getDirection()).toBe('RL');
classDb.clear();
parser.parse(`classDiagram
class B`);
expect(classDb.getDirection()).toBe('TB');
});
});

describe('when parsing class defined in brackets', function () {
Expand Down

0 comments on commit b263164

Please sign in to comment.