2021-02-01 21:23:14 +01:00
|
|
|
'use strict';
|
|
|
|
|
2020-11-23 19:21:51 +01:00
|
|
|
describe('import functionality', function () {
|
|
|
|
beforeEach(function (cb) {
|
2014-12-28 02:27:53 +01:00
|
|
|
helper.newPad(cb); // creates a new pad
|
|
|
|
this.timeout(60000);
|
|
|
|
});
|
|
|
|
|
2020-11-23 19:21:51 +01:00
|
|
|
function getinnertext() {
|
|
|
|
const inner = helper.padInner$;
|
|
|
|
if (!inner) {
|
|
|
|
return '';
|
2015-01-07 07:03:53 +01:00
|
|
|
}
|
2020-11-23 19:21:51 +01:00
|
|
|
let newtext = '';
|
|
|
|
inner('div').each((line, el) => {
|
|
|
|
newtext += `${el.innerHTML}\n`;
|
|
|
|
});
|
|
|
|
return newtext;
|
2014-12-28 02:27:53 +01:00
|
|
|
}
|
2020-11-23 19:21:51 +01:00
|
|
|
function importrequest(data, importurl, type) {
|
|
|
|
let error;
|
|
|
|
const result = $.ajax({
|
2014-12-28 02:27:53 +01:00
|
|
|
url: importurl,
|
2020-11-23 19:21:51 +01:00
|
|
|
type: 'post',
|
2014-12-28 02:27:53 +01:00
|
|
|
processData: false,
|
|
|
|
async: false,
|
|
|
|
contentType: 'multipart/form-data; boundary=boundary',
|
|
|
|
accepts: {
|
2020-11-23 19:21:51 +01:00
|
|
|
text: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
2014-12-28 02:27:53 +01:00
|
|
|
},
|
2021-02-01 21:23:14 +01:00
|
|
|
data: [
|
|
|
|
'Content-Type: multipart/form-data; boundary=--boundary',
|
|
|
|
'',
|
|
|
|
'--boundary',
|
|
|
|
`Content-Disposition: form-data; name="file"; filename="import.${type}"`,
|
|
|
|
'Content-Type: text/plain',
|
|
|
|
'',
|
|
|
|
data,
|
|
|
|
'',
|
|
|
|
'--boundary',
|
|
|
|
].join('\r\n'),
|
2020-11-23 19:21:51 +01:00
|
|
|
error(res) {
|
|
|
|
error = res;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
expect(error).to.be(undefined);
|
|
|
|
return result;
|
2014-12-28 02:27:53 +01:00
|
|
|
}
|
2020-11-23 19:21:51 +01:00
|
|
|
function exportfunc(link) {
|
|
|
|
const exportresults = [];
|
2014-12-28 02:27:53 +01:00
|
|
|
$.ajaxSetup({
|
2020-11-23 19:21:51 +01:00
|
|
|
async: false,
|
|
|
|
});
|
|
|
|
$.get(`${link}/export/html`, (data) => {
|
|
|
|
const start = data.indexOf('<body>');
|
|
|
|
const end = data.indexOf('</body>');
|
|
|
|
const html = data.substr(start + 6, end - start - 6);
|
|
|
|
exportresults.push(['html', html]);
|
|
|
|
});
|
|
|
|
$.get(`${link}/export/txt`, (data) => {
|
|
|
|
exportresults.push(['txt', data]);
|
|
|
|
});
|
|
|
|
return exportresults;
|
2014-12-28 02:27:53 +01:00
|
|
|
}
|
|
|
|
|
2020-11-23 19:21:51 +01:00
|
|
|
xit('import a pad with newlines from txt', function (done) {
|
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
|
|
|
const textWithNewLines = 'imported text\nnewline';
|
|
|
|
importrequest(textWithNewLines, importurl, 'txt');
|
2021-02-01 21:23:14 +01:00
|
|
|
helper.waitFor(() => expect(getinnertext())
|
|
|
|
.to.be('<span class="">imported text</span>\n<span class="">newline</span>\n<br>\n'));
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
|
|
|
expect(results[0][1]).to.be('imported text<br>newline<br><br>');
|
|
|
|
expect(results[1][1]).to.be('imported text\nnewline\n\n');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
xit('import a pad with newlines from html', function (done) {
|
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
|
|
|
const htmlWithNewLines = '<html><body>htmltext<br/>newline</body></html>';
|
|
|
|
importrequest(htmlWithNewLines, importurl, 'html');
|
2021-02-01 21:23:14 +01:00
|
|
|
helper.waitFor(() => expect(getinnertext())
|
|
|
|
.to.be('<span class="">htmltext</span>\n<span class="">newline</span>\n<br>\n'));
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
|
|
|
expect(results[0][1]).to.be('htmltext<br>newline<br><br>');
|
|
|
|
expect(results[1][1]).to.be('htmltext\nnewline\n\n');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
xit('import a pad with attributes from html', function (done) {
|
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
2021-02-01 21:23:14 +01:00
|
|
|
const htmlWithNewLines = '<html><body>htmltext<br/><span class="b s i u">' +
|
|
|
|
'<b><i><s><u>newline</u></s></i></b></body></html>';
|
2020-11-23 19:21:51 +01:00
|
|
|
importrequest(htmlWithNewLines, importurl, 'html');
|
2021-02-01 21:23:14 +01:00
|
|
|
helper.waitFor(() => expect(getinnertext())
|
|
|
|
.to.be('<span class="">htmltext</span>\n<span class="b i s u">' +
|
|
|
|
'<b><i><s><u>newline</u></s></i></b></span>\n<br>\n'));
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(results[0][1])
|
|
|
|
.to.be('htmltext<br><strong><em><s><u>newline</u></s></em></strong><br><br>');
|
2020-11-23 19:21:51 +01:00
|
|
|
expect(results[1][1]).to.be('htmltext\nnewline\n\n');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
xit('import a pad with bullets from html', function (done) {
|
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
2021-02-01 21:23:14 +01:00
|
|
|
const htmlWithBullets = '<html><body><ul class="list-bullet1"><li>bullet line 1</li>' +
|
|
|
|
'<li>bullet line 2</li><ul class="list-bullet2"><li>bullet2 line 1</li>' +
|
|
|
|
'<li>bullet2 line 2</li></ul></ul></body></html>';
|
2020-11-23 19:21:51 +01:00
|
|
|
importrequest(htmlWithBullets, importurl, 'html');
|
2021-02-01 21:23:14 +01:00
|
|
|
helper.waitFor(() => expect(getinnertext()).to.be(
|
|
|
|
'<ul class="list-bullet1"><li><span class="">bullet line 1</span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet1"><li><span class="">bullet line 2</span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet2"><li><span class="">bullet2 line 1</span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet2"><li><span class="">bullet2 line 2</span></li></ul>\n' +
|
|
|
|
'<br>\n'));
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(results[0][1]).to.be(
|
|
|
|
'<ul class="bullet"><li>bullet line 1</li><li>bullet line 2</li>' +
|
|
|
|
'<ul class="bullet"><li>bullet2 line 1</li><li>bullet2 line 2</li></ul></ul><br>');
|
|
|
|
expect(results[1][1])
|
|
|
|
.to.be('\t* bullet line 1\n\t* bullet line 2\n' +
|
|
|
|
'\t\t* bullet2 line 1\n\t\t* bullet2 line 2\n\n');
|
2020-11-23 19:21:51 +01:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
xit('import a pad with bullets and newlines from html', function (done) {
|
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
2021-02-01 21:23:14 +01:00
|
|
|
const htmlWithBullets = '<html><body><ul class="list-bullet1"><li>bullet line 1</li>' +
|
|
|
|
'</ul><br/><ul class="list-bullet1"><li>bullet line 2</li><ul class="list-bullet2">' +
|
|
|
|
'<li>bullet2 line 1</li></ul></ul><br/><ul class="list-bullet1">' +
|
|
|
|
'<ul class="list-bullet2"><li>bullet2 line 2</li></ul></ul></body></html>';
|
2020-11-23 19:21:51 +01:00
|
|
|
importrequest(htmlWithBullets, importurl, 'html');
|
2021-02-01 21:23:14 +01:00
|
|
|
helper.waitFor(() => expect(getinnertext()).to.be(
|
|
|
|
'<ul class="list-bullet1"><li><span class="">bullet line 1</span></li></ul>\n' +
|
|
|
|
'<br>\n' +
|
|
|
|
'<ul class="list-bullet1"><li><span class="">bullet line 2</span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet2"><li><span class="">bullet2 line 1</span></li></ul>\n' +
|
|
|
|
'<br>\n' +
|
|
|
|
'<ul class="list-bullet2"><li><span class="">bullet2 line 2</span></li></ul>\n' +
|
|
|
|
'<br>\n'));
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(results[0][1]).to.be(
|
|
|
|
'<ul class="bullet"><li>bullet line 1</li></ul><br><ul class="bullet">' +
|
|
|
|
'<li>bullet line 2</li><ul class="bullet"><li>bullet2 line 1</li></ul>' +
|
|
|
|
'</ul><br><ul><ul class="bullet"><li>bullet2 line 2</li></ul></ul><br>');
|
|
|
|
expect(results[1][1]).to.be(
|
|
|
|
'\t* bullet line 1\n\n\t* bullet line 2\n\t\t* bullet2 line 1\n\n\t\t* bullet2 line 2\n\n');
|
2020-11-23 19:21:51 +01:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
xit('import a pad with bullets and newlines and attributes from html', function (done) {
|
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
2021-02-01 21:23:14 +01:00
|
|
|
const htmlWithBullets = '<html><body><ul class="list-bullet1"><li>bullet line 1</li>' +
|
|
|
|
'</ul><br/><ul class="list-bullet1"><li>bullet line 2</li>' +
|
|
|
|
'<ul class="list-bullet2"><li>bullet2 line 1</li></ul></ul>' +
|
|
|
|
'<br/><ul class="list-bullet1"><ul class="list-bullet2"><ul class="list-bullet3">' +
|
|
|
|
'<ul class="list-bullet4"><li><span class="b s i u"><b><i>' +
|
|
|
|
'<s><u>bullet4 line 2 bisu</u></s></i></b></span></li><li>' +
|
|
|
|
'<span class="b s "><b><s>bullet4 line 2 bs</s></b></span></li>' +
|
|
|
|
'<li><span class="u"><u>bullet4 line 2 u</u></span><span class="u i s">' +
|
|
|
|
'<i><s><u>uis</u></s></i></span></li></ul></ul></ul></ul></body></html>';
|
2020-11-23 19:21:51 +01:00
|
|
|
importrequest(htmlWithBullets, importurl, 'html');
|
2021-02-01 21:23:14 +01:00
|
|
|
helper.waitFor(() => expect(getinnertext()).to.be(
|
|
|
|
'<ul class="list-bullet1"><li><span class="">bullet line 1</span></li></ul>\n<br>\n' +
|
|
|
|
'<ul class="list-bullet1"><li><span class="">bullet line 2</span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet2"><li><span class="">bullet2 line 1</span></li></ul>\n<br>\n' +
|
|
|
|
'<ul class="list-bullet4"><li><span class="b i s u">' +
|
|
|
|
'<b><i><s><u>bullet4 line 2 bisu</u></s></i></b></span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet4"><li><span class="b s">' +
|
|
|
|
'<b><s>bullet4 line 2 bs</s></b></span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet4"><li><span class="u"><u>bullet4 line 2 u</u>' +
|
|
|
|
'</span><span class="i s u"><i><s><u>uis</u></s></i></span></li></ul>\n' +
|
|
|
|
'<br>\n'));
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(results[0][1]).to.be(
|
|
|
|
'<ul class="bullet"><li>bullet line 1</li></ul>' +
|
|
|
|
'<br><ul class="bullet"><li>bullet line 2</li><ul class="bullet"><li>bullet2 line 1</li>' +
|
|
|
|
'</ul></ul><br><ul><ul><ul><ul class="bullet"><li><strong><em><s><u>bullet4 line 2 bisu' +
|
|
|
|
'</u></s></em></strong></li><li><strong><s>bullet4 line 2 bs</s></strong>' +
|
|
|
|
'</li><li><u>bullet4 line 2 u<em><s>uis</s></em></u></li></ul></ul></ul></ul><br>');
|
|
|
|
expect(results[1][1]).to.be(
|
|
|
|
'\t* bullet line 1\n\n\t* bullet line 2\n\t\t* bullet2 line 1\n\n\t\t\t\t* bullet4 line 2' +
|
|
|
|
' bisu\n\t\t\t\t* bullet4 line 2 bs\n\t\t\t\t* bullet4 line 2 uuis\n\n');
|
2020-11-23 19:21:51 +01:00
|
|
|
done();
|
|
|
|
});
|
|
|
|
xit('import a pad with nested bullets from html', function (done) {
|
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
2021-02-01 21:23:14 +01:00
|
|
|
const htmlWithBullets = '<html><body><ul class="list-bullet1"><li>bullet line 1</li>' +
|
|
|
|
'</ul><ul class="list-bullet1"><li>bullet line 2</li><ul class="list-bullet2">' +
|
|
|
|
'<li>bullet2 line 1</li></ul></ul><ul class="list-bullet1"><ul class="list-bullet2">' +
|
|
|
|
'<ul class="list-bullet3"><ul class="list-bullet4"><li>bullet4 line 2</li>' +
|
|
|
|
'<li>bullet4 line 2</li><li>bullet4 line 2</li></ul><li>bullet3 line 1</li></ul>' +
|
|
|
|
'</ul><li>bullet2 line 1</li></ul></body></html>';
|
2020-11-23 19:21:51 +01:00
|
|
|
importrequest(htmlWithBullets, importurl, 'html');
|
|
|
|
const oldtext = getinnertext();
|
2021-02-01 21:23:14 +01:00
|
|
|
helper.waitFor(() => oldtext !== getinnertext()
|
2020-11-23 19:21:51 +01:00
|
|
|
// return expect(getinnertext()).to.be('\
|
|
|
|
// <ul class="list-bullet1"><li><span class="">bullet line 1</span></li></ul>\n\
|
|
|
|
// <ul class="list-bullet1"><li><span class="">bullet line 2</span></li></ul>\n\
|
|
|
|
// <ul class="list-bullet2"><li><span class="">bullet2 line 1</span></li></ul>\n\
|
|
|
|
// <ul class="list-bullet4"><li><span class="">bullet4 line 2</span></li></ul>\n\
|
|
|
|
// <ul class="list-bullet4"><li><span class="">bullet4 line 2</span></li></ul>\n\
|
|
|
|
// <ul class="list-bullet4"><li><span class="">bullet4 line 2</span></li></ul>\n\
|
|
|
|
// <br>\n')
|
|
|
|
);
|
2020-03-24 01:04:24 +01:00
|
|
|
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(results[0][1]).to.be(
|
|
|
|
'<ul class="bullet"><li>bullet line 1</li><li>bullet line 2</li>' +
|
|
|
|
'<ul class="bullet"><li>bullet2 line 1</li><ul><ul class="bullet"><li>bullet4 line 2</li>' +
|
|
|
|
'<li>bullet4 line 2</li><li>bullet4 line 2</li></ul><li>bullet3 line 1</li></ul></ul>' +
|
|
|
|
'<li>bullet2 line 1</li></ul><br>');
|
|
|
|
expect(results[1][1]).to.be(
|
|
|
|
'\t* bullet line 1\n\t* bullet line 2\n\t\t* bullet2 line 1\n\t\t\t\t* bullet4 line 2' +
|
|
|
|
'\n\t\t\t\t* bullet4 line 2\n\t\t\t\t* bullet4 line 2\n\t\t\t* bullet3 line 1' +
|
|
|
|
'\n\t* bullet2 line 1\n\n');
|
2020-11-23 19:21:51 +01:00
|
|
|
done();
|
|
|
|
});
|
2021-02-01 21:23:14 +01:00
|
|
|
xit('import with 8 levels of bullets and newlines and attributes from html', function (done) {
|
2020-11-23 19:21:51 +01:00
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
2021-02-01 21:23:14 +01:00
|
|
|
const htmlWithBullets =
|
|
|
|
'<html><body><ul class="list-bullet1"><li>bullet line 1</li>' +
|
|
|
|
'</ul><br/><ul class="list-bullet1"><li>bullet line 2</li><ul class="list-bullet2"><li>' +
|
|
|
|
'bullet2 line 1</li></ul></ul><br/><ul class="list-bullet1"><ul class="list-bullet2">' +
|
|
|
|
'<ul class="list-bullet3"><ul class="list-bullet4"><li><span class="b s i u"><b><i>' +
|
|
|
|
'<s><u>bullet4 line 2 bisu</u></s></i></b></span></li><li><span class="b s "><b><s>' +
|
|
|
|
'bullet4 line 2 bs</s></b></span></li><li><span class="u"><u>bullet4 line 2 u' +
|
|
|
|
'</u></span><span class="u i s"><i><s><u>uis</u></s></i></span></li>' +
|
|
|
|
'<ul class="list-bullet5"><ul class="list-bullet6"><ul class="list-bullet7">' +
|
|
|
|
'<ul class="list-bullet8"><li><span class="">foo</span></li><li><span class="b s">' +
|
|
|
|
'<b><s>foobar bs</b></s></span></li></ul></ul></ul></ul><ul class="list-bullet5">' +
|
|
|
|
'<li>foobar</li></ul></ul></ul></ul></body></html>';
|
2020-11-23 19:21:51 +01:00
|
|
|
importrequest(htmlWithBullets, importurl, 'html');
|
2021-02-01 21:23:14 +01:00
|
|
|
helper.waitFor(() => expect(getinnertext()).to.be(
|
|
|
|
'<ul class="list-bullet1"><li><span class="">bullet line 1</span></li></ul>\n<br>\n' +
|
|
|
|
'<ul class="list-bullet1"><li><span class="">bullet line 2</span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet2"><li><span class="">bullet2 line 1</span></li></ul>\n<br>\n' +
|
|
|
|
'<ul class="list-bullet4"><li><span class="b i s u"><b><i><s><u>bullet4 line 2 bisu</u>' +
|
|
|
|
'</s></i></b></span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet4"><li><span class="b s"><b><s>bullet4 line 2 bs</s></b>' +
|
|
|
|
'</span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet4"><li><span class="u"><u>bullet4 line 2 u</u></span>' +
|
|
|
|
'<span class="i s u"><i><s><u>uis</u></s>' +
|
|
|
|
'</i></span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet8"><li><span class="">foo</span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet8"><li><span class="b s"><b><s>foobar bs</s></b>' +
|
|
|
|
'</span></li></ul>\n' +
|
|
|
|
'<ul class="list-bullet5"><li><span class="">foobar</span></li></ul>\n' +
|
|
|
|
'<br>\n'));
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(results[0][1]).to.be(
|
|
|
|
'<ul class="bullet"><li>bullet line 1</li></ul><br><ul class="bullet">' +
|
|
|
|
'<li>bullet line 2</li><ul class="bullet"><li>bullet2 line 1</li></ul></ul>' +
|
|
|
|
'<br><ul><ul><ul><ul class="bullet"><li><strong><em><s><u>' +
|
|
|
|
'bullet4 line 2 bisu</u></s></em></strong></li><li><strong><s>' +
|
|
|
|
'bullet4 line 2 bs</s></strong></li><li><u>bullet4 line 2 u<em>' +
|
|
|
|
'<s>uis</s></em></u></li><ul><ul><ul><ul class="bullet"><li>foo</li>' +
|
|
|
|
'<li><strong><s>foobar bs</s></strong></li></ul></ul></ul><li>foobar</li>' +
|
|
|
|
'</ul></ul></ul></ul></ul><br>');
|
|
|
|
expect(results[1][1]).to.be(
|
|
|
|
'\t* bullet line 1\n\n\t* bullet line 2\n\t\t* ' +
|
|
|
|
'bullet2 line 1\n\n\t\t\t\t* bullet4 line 2 bisu\n\t\t\t\t* bullet4 line 2 ' +
|
|
|
|
'bs\n\t\t\t\t* bullet4 line 2 uuis\n\t\t\t\t\t\t\t\t* foo\n\t\t\t\t\t\t\t\t* ' +
|
|
|
|
'foobar bs\n\t\t\t\t\t* foobar\n\n');
|
2020-11-23 19:21:51 +01:00
|
|
|
done();
|
|
|
|
});
|
2020-03-24 01:04:24 +01:00
|
|
|
|
2020-11-23 19:21:51 +01:00
|
|
|
xit('import a pad with ordered lists from html', function (done) {
|
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
2021-02-01 21:23:14 +01:00
|
|
|
const htmlWithBullets = '<html><body><ol class="list-number1" start="1">' +
|
|
|
|
'<li>number 1 line 1</li></ol><ol class="list-number1" start="2">' +
|
|
|
|
'<li>number 2 line 2</li></ol></body></html>';
|
2020-11-23 01:36:31 +01:00
|
|
|
importrequest(htmlWithBullets, importurl, 'html');
|
2020-11-23 19:21:51 +01:00
|
|
|
console.error(getinnertext());
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(getinnertext()).to.be(
|
|
|
|
'<ol class="list-number1" start="1"><li><span class="">number 1 line 1</span></li></ol>\n' +
|
|
|
|
'<ol class="list-number1" start="2"><li><span class="">number 2 line 2</span></li></ol>\n' +
|
|
|
|
'<br>\n');
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(results[0][1]).to.be(
|
|
|
|
'<ol class="list-number1" start="1"><li>number 1 line 1</li>' +
|
|
|
|
'</ol><ol class="list-number1" start="2"><li>number 2 line 2</li></ol>');
|
2020-11-23 19:21:51 +01:00
|
|
|
expect(results[1][1]).to.be('');
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
xit('import a pad with ordered lists and newlines from html', function (done) {
|
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
2021-02-01 21:23:14 +01:00
|
|
|
const htmlWithBullets = '<html><body><ol class="list-number1" start="1">' +
|
|
|
|
'<li>number 9 line 1</li></ol><br/><ol class="list-number1" start="2">' +
|
|
|
|
'<li>number 10 line 2</li><ol class="list-number2">' +
|
|
|
|
'<li>number 2 times line 1</li></ol></ol><br/><ol class="list-bullet1">' +
|
|
|
|
'<ol class="list-number2"><li>number 2 times line 2</li></ol></ol></body></html>';
|
2020-11-23 19:21:51 +01:00
|
|
|
importrequest(htmlWithBullets, importurl, 'html');
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(getinnertext()).to.be(
|
|
|
|
'<ol class="list-number1" start="1"><li><span class="">number 9 line 1</span></li></ol>\n' +
|
|
|
|
'<br>\n' +
|
|
|
|
'<ol class="list-number1" start="2"><li><span class="">number 10 line 2</span></li>' +
|
|
|
|
'</ol>\n' +
|
|
|
|
'<ol class="list-number2"><li><span class="">number 2 times line 1</span></li></ol>\n' +
|
|
|
|
'<br>\n' +
|
|
|
|
'<ol class="list-number2"><li><span class="">number 2 times line 2</span></li></ol>\n' +
|
|
|
|
'<br>\n');
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
|
|
|
console.error(results);
|
|
|
|
done();
|
|
|
|
});
|
2021-02-01 21:23:14 +01:00
|
|
|
xit('import with nested ordered lists and attributes and newlines from html', function (done) {
|
2020-11-23 19:21:51 +01:00
|
|
|
const importurl = `${helper.padChrome$.window.location.href}/import`;
|
2021-02-01 21:23:14 +01:00
|
|
|
const htmlWithBullets = '<html><body><ol class="list-number1" start="1"><li>' +
|
|
|
|
'<span class="b s i u"><b><i><s><u>bold strikethrough italics underline</u>' +
|
|
|
|
'</s><i/></b></span> line <span class="b"><b>1bold</b></span></li>' +
|
|
|
|
'</ol><br/><span class="i"><i><ol class="list-number1" start="2">' +
|
|
|
|
'<li>number 10 line 2</li><ol class="list-number2">' +
|
|
|
|
'<li>number 2 times line 1</li></ol></ol></i></span><br/>' +
|
|
|
|
'<ol class="list-bullet1"><ol class="list-number2">' +
|
|
|
|
'<li>number 2 times line 2</li></ol></ol></body></html>';
|
2020-11-23 19:21:51 +01:00
|
|
|
importrequest(htmlWithBullets, importurl, 'html');
|
2021-02-01 21:23:14 +01:00
|
|
|
expect(getinnertext()).to.be(
|
|
|
|
'<ol class="list-number1"><li><span class="b i s u"><b><i><s><u>' +
|
|
|
|
'bold strikethrough italics underline</u></s></i></b></span><span class="">' +
|
|
|
|
' line </span><span class="b"><b>1bold</b></span></li></ol>\n' +
|
|
|
|
'<br>\n' +
|
|
|
|
'<ol class="list-number1"><li><span class="i"><i>number 10 line 2</i></span></li></ol>\n' +
|
|
|
|
'<ol class="list-number2"><li><span class="i">' +
|
|
|
|
'<i>number 2 times line 1</i></span></li></ol>\n' +
|
|
|
|
'<br>\n' +
|
|
|
|
'<ol class="list-number2"><li><span class="">number 2 times line 2</span></li></ol>\n' +
|
|
|
|
'<br>\n');
|
2020-11-23 19:21:51 +01:00
|
|
|
const results = exportfunc(helper.padChrome$.window.location.href);
|
|
|
|
console.error(results);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|