Skip to content

Commit 384227a

Browse files
committed
Fix out of order embedding of files
- added double quote as attribute marker - fixed inject order of embedded files - added e2e test covering order of embedded files Signed-off-by: Martin Mihálek <aenniw@gmail.com>
1 parent 9e62be9 commit 384227a

13 files changed

+70
-17
lines changed

cypress/integration/sidebar/config.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ context('sidebar.configurations', () => {
326326
const embedFilesIds = [
327327
'embedded-file-type',
328328
'embedded-code-fragments',
329+
'embedded-file-order',
329330
'tag-attribute',
330331
'the-code-block-highlight',
331332
];
@@ -336,7 +337,7 @@ context('sidebar.configurations', () => {
336337
cy.get(`a.section-link[href='#/embed-files?id=${id}']`)
337338
.click()
338339
.then(() => {
339-
cy.wait(500);
340+
cy.wait(750);
340341
cy.matchImageSnapshot();
341342
});
342343
});

cypress/live.server.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ console.log('[e2e tests] : args passed to live server', args)
77
const params = {
88
port: args[0] || 3000,
99
root: args[1] || fixturePath,
10-
open: false
10+
open: false,
11+
middleware: [
12+
function(req, res, next) {
13+
if (req.url === '/_media/delayed.md') {
14+
setTimeout(next, 3000);
15+
} else {
16+
next();
17+
}
18+
},
19+
],
1120
// NoBrowser: true
12-
}
13-
LiveServer.start(params)
21+
};
22+
LiveServer.start(params)

cypress/support/commands.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626

2727
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'
2828
addMatchImageSnapshotCommand({
29-
failureThreshold: 10.0,
29+
failureThreshold: 0.10,
3030
failureThresholdType: 'percent',
31-
customDiffConfig: { threshold: 10.0 },
3231
capture: 'viewport',
3332
timeout: '60000'
3433
})

docs/_media/delayed.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- This is from the `delayed.md`
2+
3+
```bash
4+
sleep 1000
5+
echo delayed
6+
exit 0
7+
```

docs/_media/non-delayed.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- This is from the `no-delay.md`
2+
3+
```bash
4+
sleep 0
5+
echo non-delayed
6+
exit 0
7+
```

0 commit comments

Comments
 (0)