mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
165 lines
4.9 KiB
TypeScript
165 lines
4.9 KiB
TypeScript
import { imgSnapshotTest } from '../../helpers/util.js';
|
|
|
|
describe('Timeline diagram', () => {
|
|
it('1: should render a simple timeline with no specific sections', () => {
|
|
imgSnapshotTest(
|
|
`timeline
|
|
title History of Social Media Platform
|
|
2002 : LinkedIn
|
|
2004 : Facebook : Google
|
|
2005 : Youtube
|
|
2006 : Twitter
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
it('2: should render a timeline diagram with sections', () => {
|
|
imgSnapshotTest(
|
|
`timeline
|
|
title Timeline of Industrial Revolution
|
|
section 17th-20th century
|
|
Industry 1.0 : Machinery, Water power, Steam <br>power
|
|
Industry 2.0 : Electricity, Internal combustion engine, Mass production
|
|
Industry 3.0 : Electronics, Computers, Automation
|
|
section 21st century
|
|
Industry 4.0 : Internet, Robotics, Internet of Things
|
|
Industry 5.0 : Artificial intelligence, Big data,3D printing
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
it('3: should render a complex timeline with sections, and long events text with <br>', () => {
|
|
imgSnapshotTest(
|
|
`timeline
|
|
title England's History Timeline
|
|
section Stone Age
|
|
7600 BC : Britain's oldest known house was built in Orkney, Scotland
|
|
6000 BC : Sea levels rise and Britain becomes an island.<br> The people who live here are hunter-gatherers.
|
|
section Broze Age
|
|
2300 BC : People arrive from Europe and settle in Britain. <br>They bring farming and metalworking.
|
|
: New styles of pottery and ways of burying the dead appear.
|
|
2200 BC : The last major building works are completed at Stonehenge.<br> People now bury their dead in stone circles.
|
|
: The first metal objects are made in Britain.Some other nice things happen. it is a good time to be alive.
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
it('4: should render a simple timeline with directives and disableMultiColor:true ', () => {
|
|
imgSnapshotTest(
|
|
`%%{init: { 'logLevel': 'debug', 'theme': 'base', 'timeline': {'disableMulticolor': true}}}%%
|
|
timeline
|
|
title History of Social Media Platform
|
|
2002 : LinkedIn
|
|
2004 : Facebook : Google
|
|
2005 : Youtube
|
|
2006 : Twitter
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
it('5: should render a simple timeline with directive overriden colors', () => {
|
|
imgSnapshotTest(
|
|
` %%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
|
|
'cScale0': '#ff0000',
|
|
'cScale1': '#00ff00',
|
|
'cScale2': '#0000ff'
|
|
} } }%%
|
|
timeline
|
|
title History of Social Media Platform
|
|
2002 : LinkedIn
|
|
2004 : Facebook : Google
|
|
2005 : Youtube
|
|
2006 : Twitter
|
|
2007 : Tumblr
|
|
2008 : Instagram
|
|
2010 : Pinterest
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
it('6: should render a simple timeline in base theme', () => {
|
|
imgSnapshotTest(
|
|
`%%{init: { 'logLevel': 'debug', 'theme': 'base' } }%%
|
|
timeline
|
|
title History of Social Media Platform
|
|
2002 : LinkedIn
|
|
2004 : Facebook : Google
|
|
2005 : Youtube
|
|
2006 : Twitter
|
|
2007 : Tumblr
|
|
2008 : Instagram
|
|
2010 : Pinterest
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
|
|
it('7: should render a simple timeline in default theme', () => {
|
|
imgSnapshotTest(
|
|
`%%{init: { 'logLevel': 'debug', 'theme': 'default' } }%%
|
|
timeline
|
|
title History of Social Media Platform
|
|
2002 : LinkedIn
|
|
2004 : Facebook : Google
|
|
2005 : Youtube
|
|
2006 : Twitter
|
|
2007 : Tumblr
|
|
2008 : Instagram
|
|
2010 : Pinterest
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
|
|
it('8: should render a simple timeline in dark theme', () => {
|
|
imgSnapshotTest(
|
|
`%%{init: { 'logLevel': 'debug', 'theme': 'dark' } }%%
|
|
timeline
|
|
title History of Social Media Platform
|
|
2002 : LinkedIn
|
|
2004 : Facebook : Google
|
|
2005 : Youtube
|
|
2006 : Twitter
|
|
2007 : Tumblr
|
|
2008 : Instagram
|
|
2010 : Pinterest
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
|
|
it('9: should render a simple timeline in neutral theme', () => {
|
|
imgSnapshotTest(
|
|
`%%{init: { 'logLevel': 'debug', 'theme': 'neutral' } }%%
|
|
timeline
|
|
title History of Social Media Platform
|
|
2002 : LinkedIn
|
|
2004 : Facebook : Google
|
|
2005 : Youtube
|
|
2006 : Twitter
|
|
2007 : Tumblr
|
|
2008 : Instagram
|
|
2010 : Pinterest
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
|
|
it('10: should render a simple timeline in forest theme', () => {
|
|
imgSnapshotTest(
|
|
`%%{init: { 'logLevel': 'debug', 'theme': 'forest' } }%%
|
|
timeline
|
|
title History of Social Media Platform
|
|
2002 : LinkedIn
|
|
2004 : Facebook : Google
|
|
2005 : Youtube
|
|
2006 : Twitter
|
|
2007 : Tumblr
|
|
2008 : Instagram
|
|
2010 : Pinterest
|
|
`,
|
|
{}
|
|
);
|
|
});
|
|
});
|