Open MiniXC opened 7 years ago
This is not 100% tested. Please test with real data and report back.
Loops + data-dev cause everything to essentially time out... The following test made all the other tests with the same frix instance go red too.
it('should respect dev flag in loops', function(done) {
let expectedHtml = noWhitespace(`
<article class="article">
<header class="header">
<h1 class="heading" data-dev="0 header heading-en" data-dev-targets="text-content">Tree</h1>
<h1 class="heading" data-dev="0 header heading-de" data-dev-targets="text-content">Baum</h1>
<p class="author">written by <a href="https://simple.wikipedia.org/wiki/Tree" data-dev="0headerauthor" data-dev-targets="url-href:link text-content:name">Wikipedia</a></p>
</header>
<p data-someattribute="something" data-dev="0" data-dev-targets="text-data-someattribute:attribute richtext-content:text">A tree is a tall plant with a trunk and branches made of wood.</p>
</article>
<br/>
<cite class="quote" data-dev="1" data-dev-targets="text-content">Insert smart-ass quote here.</cite>
<br/>
`);
let app = express();
opt.key = 'loop-test.json';
frix.render({dev: true}).then((requestHandler) => {
app.use(requestHandler);
chai.request(app).get('/loop-test').end((_, res) => {
expect(noWhitespace(res.text)).to.equal(expectedHtml);
done();
});
});
after(function() {
opt.key = 'key.json';
});
});
Just add the key to the already existing
data-dev
string.Example
To access the first item in the
items
array, frix should generate adata-dev
string ofa b 0 c
instead of the currenta b c
.