Compare commits

..

2 Commits

Author SHA1 Message Date
Corentin Sechet 40d2b3192b js: configure javascript linter (#75132)
gitea/gadjo/pipeline/head This commit looks good Details
2023-03-28 10:33:14 +02:00
Corentin Sechet d65d2e0e2f misc: update .gitignore (#75216)
gitea/gadjo/pipeline/head This commit looks good Details
2023-03-07 18:00:09 +01:00
5 changed files with 5 additions and 3176 deletions

5
.gitignore vendored
View File

@ -1,6 +1,11 @@
*.pyc
*.swp
.eggs
/dist
/gadjo.egg-info
/gadjo/locale/fr/LC_MESSAGES/django.mo
/gadjo/static/css/gadjo.css
/gadjo/static/css/icons
node_modules
MANIFEST
build

3116
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
{
"scripts": {
"test": "jest"
},
"devDependencies": {
"jest": "^28.1.3",
"jquery": "^3.6.3",
"jsdom": "^19.0.0"
}
}

View File

@ -1,19 +0,0 @@
const assert = require('assert')
const { loadDom } = require('./test-utils')
test('test foldable sections', async () => {
const { window } = await loadDom(`
<div class="section foldable">
<h2>Section Title</h2>
</div>
`)
const foldableSection = window.document.querySelector('.section.foldable')
const title = window.document.querySelector('.section.foldable > h2')
title.click()
assert(foldableSection.classList.contains('folded'))
title.click()
assert(!foldableSection.classList.contains('folded'))
})

View File

@ -1,31 +0,0 @@
const path = require('path')
const { JSDOM } = require('jsdom')
async function loadDom (content) {
const dom = new JSDOM(`
<!DOCTYPE html>
<html >
<body>
${content}
</body>
<script src="file://${require.resolve('jquery')}"></script>
<script src="file://${path.join(__dirname, '../../gadjo/static/js/gadjo.js')}"></script>
<script>
jQuery(() => document.dispatchEvent(new Event("test:ready")))
</script>
</html>`, {
runScripts: 'dangerously',
resources: 'usable',
})
await new Promise((resolve) => {
dom.window.document.addEventListener('test:ready', () => {
resolve()
})
})
return dom
}
module.exports = { loadDom }