Skip to content

Commit

Permalink
fix(class): #5624 Reset direction to default in classDiagram
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Jul 7, 2024
1 parent adf4351 commit a80dd71
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 a80dd71

Please sign in to comment.