Test with github actions
This commit is contained in:
Родитель
df07bd704f
Коммит
905e51758a
|
@ -0,0 +1,19 @@
|
|||
name: Node CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js 12.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: npm install, build, and test
|
||||
run: |
|
||||
npm ci
|
||||
npm test
|
||||
env:
|
||||
CI: true
|
18
test/test.js
18
test/test.js
|
@ -1,7 +1,7 @@
|
|||
import subscribe from '../dist/index.esm.js'
|
||||
|
||||
describe('paste-markdown', function() {
|
||||
describe('with quotable selection', function() {
|
||||
describe('installed on textarea', function() {
|
||||
let subscription, textarea
|
||||
beforeEach(function() {
|
||||
document.body.innerHTML = `
|
||||
|
@ -17,17 +17,12 @@ describe('paste-markdown', function() {
|
|||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
it('pastes image uris as markdown', function() {
|
||||
it('turns image uris into markdown', function() {
|
||||
paste(textarea, {'text/uri-list': 'https://github.com/github.png\r\nhttps://github.com/hubot.png'})
|
||||
assert.include(textarea.value, '![](https://github.com/github.png)\n\n![](https://github.com/hubot.png)')
|
||||
})
|
||||
|
||||
it('pastes gfm into markdown', function() {
|
||||
paste(textarea, {'text/plain': 'hello', 'text/x-gfm': '# hello'})
|
||||
assert.include(textarea.value, '# hello')
|
||||
})
|
||||
|
||||
it('pastes html tables as markdown', function() {
|
||||
it('turns html tables into markdown', function() {
|
||||
const data = {
|
||||
'text/html': `
|
||||
<table>
|
||||
|
@ -43,7 +38,7 @@ describe('paste-markdown', function() {
|
|||
assert.include(textarea.value, 'name | origin\n-- | --\nhubot | github\nbender | futurama')
|
||||
})
|
||||
|
||||
it('does not paste excluded content as markdown', function() {
|
||||
it('rejects HTML from github.com markup', function() {
|
||||
const data = {
|
||||
'text/html': `
|
||||
<table class="js-comment">
|
||||
|
@ -58,6 +53,11 @@ describe('paste-markdown', function() {
|
|||
paste(textarea, data)
|
||||
assert.equal(textarea.value, '')
|
||||
})
|
||||
|
||||
it('accepts x-gfm', function() {
|
||||
paste(textarea, {'text/plain': 'hello', 'text/x-gfm': '# hello'})
|
||||
assert.include(textarea.value, '# hello')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче