Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(common): add duplicate accessiblty options test cases #47

Merged
merged 1 commit into from
May 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions packages/mermaid-parser/tests/common/accessible.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ describe('when parsing accTitle', () => {
expect(value.accTitle).toBe('sample accessibility');
});

// it('should handle duplicate accTitle', async () => {
// const str = `pie accTitle: sample accessibility
// accTitle:`;
// const result = (await parser(str)).parseResult;
// // expect(result.parserErrors).toHaveLength(0);
// // expect(result.lexerErrors).toHaveLength(0);

// const value = result.value;
// expect(value.title).toBeUndefined();
// expect(value.accDescr).toBeUndefined();
// expect(value.accTitle).toBeUndefined();
// });

// it('should handle valid accTitle with title', async () => {
// const str = `pie accTitle: sample accessibility + title test`;
// const result = (await parser(str)).parseResult;
Expand Down Expand Up @@ -172,6 +185,19 @@ describe('when parsing accDescr', () => {
expect(value.accTitle).toBeUndefined();
});

// it('should handle duplicate single line accDescr', async () => {
// const str = `pie accDescr: sample accessibility
// accDescr:`;
// const result = (await parser(str)).parseResult;
// expect(result.parserErrors).toHaveLength(0);
// expect(result.lexerErrors).toHaveLength(0);

// const value = result.value;
// expect(value.title).toBeUndefined();
// expect(value.accDescr).toBeUndefined();
// expect(value.accTitle).toBeUndefined();
// });

// it('should handle valid single line accDescr with title', async () => {
// const str = `pie accDescr: sample description + title test`;
// const result = (await parser(str)).parseResult;
Expand Down Expand Up @@ -267,6 +293,23 @@ describe('when parsing accDescr', () => {
expect(value.accTitle).toBeUndefined();
});

// it('should handle duplicate multi line accDescr', async () => {
// const str = `pie accDescr {
// sample accessibility
// }
// accDescr {

// }`;
// const result = (await parser(str)).parseResult;
// // expect(result.parserErrors).toHaveLength(0);
// // expect(result.lexerErrors).toHaveLength(0);

// const value = result.value;
// expect(value.title).toBeUndefined();
// expect(value.accDescr).toBeUndefined();
// expect(value.accTitle).toBeUndefined();
// });

// it('should handle valid multi line accDescr with title', async () => {
// const str = `pie accDescr {
// sample description +
Expand Down Expand Up @@ -296,4 +339,27 @@ describe('when parsing accDescr', () => {
expect(value.accDescr).toBe('sample description +\naccTitle: test');
expect(value.accTitle).toBeUndefined();
});

// both
// it.each([
// `pie accDescr {
// sample accessibility
// }
// accDescr:`,

// `pie accDescr: sample accessibility
// accDescr {}`,
// ])(
// 'should handle duplicate single and multi line accDescr',
// async (str: string) => {
// const result = (await parser(str)).parseResult;
// // expect(result.parserErrors).toHaveLength(0);
// // expect(result.lexerErrors).toHaveLength(0);

// const value = result.value;
// expect(value.title).toBeUndefined();
// expect(value.accDescr).toBeUndefined();
// expect(value.accTitle).toBeUndefined();
// },
// );
});