Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
* master:
  rollback mermaid-js#288 due to mermaid-js#338
  hide netlify on github
  format netlify
  hide netlify on github
  Fix clock
  Fix clock
  Fix test
  Fix test
  Fix test
  Fix test
  remove eslint ignors
  Fix test
  Add powered by netlify
  • Loading branch information
sidharthv96 committed Sep 8, 2021
2 parents 26afd28 + 52afad3 commit 40a0c22
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 510 deletions.
2 changes: 0 additions & 2 deletions cypress/integration/actions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
describe('Check actions', () => {
// eslint-disable-next-line mocha/no-hooks-for-single-case
beforeEach(() => {
cy.clearLocalStorage();
cy.visit('/edit');
cy.contains('Actions').click();
});
it('should update markdown code', () => {
cy.get('#markdown')
Expand Down
5 changes: 4 additions & 1 deletion cypress/integration/history.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
describe('Save History', () => {
beforeEach(() => {
cy.clock();
cy.clearLocalStorage();
cy.visit('/edit');
cy.contains('Actions').click();
cy.contains('History').click();
});

it('should save when clicked', () => {
cy.get('#historyList').find('li').should('have.length', 0);
cy.get('#historyList').contains('No items in History');
Expand Down Expand Up @@ -43,7 +47,6 @@ describe('Save History', () => {
});

it('should auto save history', () => {
cy.clock();
cy.get('#editor').type(' C --> HistoryTest');
cy.tick(70000);
cy.contains('Timeline').click();
Expand Down
2 changes: 2 additions & 0 deletions cypress/integration/loadSite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('Site Loads', () => {

it('should load diagram from gist', () => {
cy.visit(`/edit?gist=https://gist.github.com/sidharthv96/6268a23e673a533dcb198f241fd7012a`);
cy.contains('History').click();
cy.contains('Go shopping!!');
cy.contains('Revisions');
cy.contains('sidharthv96 v8f8f1e2');
Expand All @@ -45,6 +46,7 @@ describe('Site Loads', () => {
cy.visit(
'/edit?gist=https://gist.github.com/sidharthv96/6268a23e673a533dcb198f241fd7012a/ec9b4ab0e41e4ff6287326cd3cb47affd7851e19'
);
cy.contains('History').click();
cy.contains('Party');
cy.contains('Revisions');
cy.contains('sidharthv96 v7851e19');
Expand Down
2 changes: 1 addition & 1 deletion cypress/snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
"1": "{\"code\":\"graph TD\\n A[Party] -->|Get money| B(Go shopping!!)\\n \",\"mermaid\":\"{\\n \\\"theme\\\": \\\"forest\\\",\\n \\\"test\\\": \\\"hello world\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":true,\"loader\":{\"type\":\"files\",\"config\":{\"codeURL\":\"https://gist.githubusercontent.com/sidharthv96/6268a23e673a533dcb198f241fd7012a/raw/4eb03887e6a41397e80bdcdbf94017c498f8f1e2/code.mmd\",\"configURL\":\"https://gist.githubusercontent.com/sidharthv96/6268a23e673a533dcb198f241fd7012a/raw/4eb03887e6a41397e80bdcdbf94017c498f8f1e2/config.json\"}}}"
}
},
"__version": "8.3.0",
"__version": "8.3.1",
"Auto sync tests": {
"should dim diagram when code is edited": {
"1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n C --> Test\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":false,\"updateDiagram\":false}"
Expand Down
15 changes: 14 additions & 1 deletion src/lib/components/actions.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts">
import { browser } from '$app/env';
import Card from '$lib/components/card/card.svelte';
import type { State } from '$lib/types';
import { codeStore } from '$lib/util/state';
Expand Down Expand Up @@ -131,6 +133,10 @@
let imagemodeselected = 'auto';
let userimagesize = 1080;
let isNetlify = false;
if (browser && ['mermaid.live', 'netlify'].some((path) => window.location.host.includes(path))) {
isNetlify = true;
}
codeStore.subscribe((state: State) => {
const stateCopy = JSON.parse(JSON.stringify(state));
if (typeof stateCopy.mermaid === 'string') {
Expand All @@ -143,7 +149,7 @@
});
</script>

<Card title="Actions" isOpen={false}>
<Card title="Actions" isOpen={true}>
<div class="flex flex-wrap gap-2 m-2">
{#if isClipboardAvailable()}
<button class="action-btn w-full" on:click={onCopyClipboard}
Expand Down Expand Up @@ -194,5 +200,12 @@
<button class="btn text-white flex-auto" on:click={loadGist}> Load Gist </button>
</label>
</div>
{#if isNetlify}
<div class="w-full flex items-center justify-center">
<a class="link underline text-gray-500 text-sm" href="https://netlify.com">
This site is powered by Netlify
</a>
</div>
{/if}
</div>
</Card>
4 changes: 2 additions & 2 deletions src/lib/components/card/tabs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
{#each tabs as tab}
<li class="mr-2 last:mr-0 w-28 h-6 flex-auto text-center">
<div
class="text cursor-pointer font-semibold min-w-16 w-auto px-2 py-1 -mb-4 rounded-t block leading-normal {activeTabID ===
class="text cursor-pointer font-semibold min-w-16 w-auto px-2 py-1 -mb-4 rounded-t flex justify-center items-center leading-normal {activeTabID ===
tab.id
? 'text-indigo-500 bg-white border-white'
: 'text-white bg-indigo-500 border-indigo-500 hover:bg-indigo-600'}"
on:click|stopPropagation={() => toggleTabs(tab)}>
<i class={tab.icon} />
<i class="{tab.icon} mr-1" />
{tab.title}
</div>
</li>
Expand Down
Loading

0 comments on commit 40a0c22

Please sign in to comment.