This commit is contained in:
Mu-An Chiou 2020-02-18 13:53:21 -05:00
Родитель df07bd704f
Коммит 905e51758a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CD0B1EEC7A35239E
2 изменённых файлов: 28 добавлений и 9 удалений

19
.github/workflows/test.yml поставляемый Normal file
Просмотреть файл

@ -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

Просмотреть файл

@ -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')
})
})
})