-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slate, webpack, toastify and cypress (#6852)
* chore: upgrade slate editor to 0.9 * chore: upgrade slate editor to 0.9 * chore: update cypress to 12, update configs and tests to work with it * chore: replace redux-notifications with toastify * chore: lint & test recent changes * chore: upgrade slate editor to 0.9 * chore: update webpack to 5 * chore: upgrade slate editor to 0.9 * chore: lint & test recent changes * chore: update code to ts4 * chore: lint proxy server and lint some code * chore: lint & set node version in workflow * fix: update ObjectControl and ListControl proptypes * fix: add table renderers and serializers * feat: add history to visual and raw editor * feat: add thematic break * fix: add image renderer and fix thematic-break * chore: cleanup old slate code * test: deploy rc
- Loading branch information
Showing
192 changed files
with
9,271 additions
and
7,566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
projectId: '1c35bs', | ||
retries: { | ||
runMode: 4, | ||
openMode: 0, | ||
}, | ||
e2e: { | ||
video: false, | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
return require('./cypress/plugins/index.js')(on, config); | ||
}, | ||
baseUrl: 'http://localhost:8080', | ||
specPattern: 'cypress/e2e/*spec*.js', | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import { oneLineTrim, stripIndent } from 'common-tags'; | ||
import '../utils/dismiss-local-backup'; | ||
|
||
describe('Markdown widget code block', () => { | ||
before(() => { | ||
Cypress.config('defaultCommandTimeout', 4000); | ||
cy.task('setupBackend', { backend: 'test' }); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.loginAndNewPost(); | ||
cy.clearMarkdownEditorContent(); | ||
}); | ||
|
||
after(() => { | ||
cy.task('teardownBackend', { backend: 'test' }); | ||
}); | ||
describe('code block', () => { | ||
it('outputs code', () => { | ||
// eslint-disable-next-line cypress/no-unnecessary-waiting | ||
cy | ||
.insertCodeBlock() | ||
.type('foo') | ||
.enter() | ||
.type('bar') | ||
.confirmMarkdownEditorContent( | ||
` | ||
${codeBlock(` | ||
foo | ||
bar | ||
`)} | ||
`, | ||
) | ||
.wait(500) | ||
.clickModeToggle().confirmMarkdownEditorContent(` | ||
${codeBlockRaw(` | ||
foo | ||
bar | ||
`)} | ||
`); | ||
}); | ||
}); | ||
}); | ||
|
||
function codeBlockRaw(content) { | ||
return ['```', ...stripIndent(content).split('\n'), '```'] | ||
.map( | ||
line => oneLineTrim` | ||
<div> | ||
<span> | ||
<span> | ||
<span>${line}</span> | ||
</span> | ||
</span> | ||
</div> | ||
`, | ||
) | ||
.join(''); | ||
} | ||
|
||
function codeBlock(content) { | ||
const lines = stripIndent(content) | ||
.split('\n') | ||
.map( | ||
(line, idx) => ` | ||
<div> | ||
<div> | ||
<div>${idx + 1}</div> | ||
</div> | ||
<pre><span>${line}</span></pre> | ||
</div> | ||
`, | ||
) | ||
.join(''); | ||
|
||
return oneLineTrim` | ||
<div> | ||
<div></div> | ||
<div> | ||
<div><label>Code Block </label> | ||
<div><button><span><svg> | ||
<path></path> | ||
</svg></span></button> | ||
<div> | ||
<div> | ||
<div><textarea></textarea></div> | ||
<div> | ||
<div></div> | ||
</div> | ||
<div> | ||
<div></div> | ||
</div> | ||
<div></div> | ||
<div></div> | ||
<div> | ||
<div> | ||
<div> | ||
<div> | ||
<div> | ||
<div> | ||
<pre><span>xxxxxxxxxx</span></pre> | ||
</div> | ||
<div></div> | ||
<div></div> | ||
<div> | ||
<div> </div> | ||
</div> | ||
<div> | ||
${lines} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div></div> | ||
<div> | ||
<div></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div> | ||
<span> | ||
<span> | ||
<span></span> | ||
</span> | ||
</span> | ||
</div> | ||
</div> | ||
<div></div> | ||
</div> | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.