mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-12 04:48:12 +02:00
Add test sample to one of the plugin. (#626)
* Added test example from a plugin. * Only load style if #news was created.
This commit is contained in:
parent
a8151176d7
commit
f8dee7e25f
@ -1,4 +1,14 @@
|
|||||||
(function() {
|
(function() {
|
||||||
|
// Register selftests when loaded by jasmine.
|
||||||
|
if (typeof PLUGINS?.SELFTEST === 'object') {
|
||||||
|
PLUGINS.SELFTEST["release-notes"] = function() {
|
||||||
|
it('should be able to fetch CHANGES.md', async function() {
|
||||||
|
let releaseNotes = await fetch(`https://raw.githubusercontent.com/cmdr2/stable-diffusion-ui/main/CHANGES.md`)
|
||||||
|
expect(releaseNotes.status).toBe(200)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
document.querySelector('#tab-container')?.insertAdjacentHTML('beforeend', `
|
document.querySelector('#tab-container')?.insertAdjacentHTML('beforeend', `
|
||||||
<span id="tab-news" class="tab">
|
<span id="tab-news" class="tab">
|
||||||
<span><i class="fa fa-bolt icon"></i> What's new?</span>
|
<span><i class="fa fa-bolt icon"></i> What's new?</span>
|
||||||
@ -13,7 +23,17 @@
|
|||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
|
|
||||||
document.querySelector('body')?.insertAdjacentHTML('beforeend', `
|
const tabNews = document.querySelector('#tab-news')
|
||||||
|
if (tabNews) {
|
||||||
|
linkTabContents(tabNews)
|
||||||
|
}
|
||||||
|
const news = document.querySelector('#news')
|
||||||
|
if (!news) {
|
||||||
|
// news tab not found, dont exec plugin code.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector('body').insertAdjacentHTML('beforeend', `
|
||||||
<style>
|
<style>
|
||||||
#tab-content-news .tab-content-inner {
|
#tab-content-news .tab-content-inner {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
@ -23,15 +43,6 @@
|
|||||||
</style>
|
</style>
|
||||||
`)
|
`)
|
||||||
|
|
||||||
const tabNews = document.querySelector('#tab-news')
|
|
||||||
if (tabNews) {
|
|
||||||
linkTabContents(tabNews)
|
|
||||||
}
|
|
||||||
const news = document.querySelector('#news')
|
|
||||||
if (!news) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const markedScript = document.createElement('script')
|
const markedScript = document.createElement('script')
|
||||||
markedScript.src = '/media/js/marked.min.js'
|
markedScript.src = '/media/js/marked.min.js'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user