mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-01-14 02:08:32 +01: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() {
|
||||
// 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', `
|
||||
<span id="tab-news" class="tab">
|
||||
<span><i class="fa fa-bolt icon"></i> What's new?</span>
|
||||
@ -13,7 +23,17 @@
|
||||
</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>
|
||||
#tab-content-news .tab-content-inner {
|
||||
max-width: 100%;
|
||||
@ -23,15 +43,6 @@
|
||||
</style>
|
||||
`)
|
||||
|
||||
const tabNews = document.querySelector('#tab-news')
|
||||
if (tabNews) {
|
||||
linkTabContents(tabNews)
|
||||
}
|
||||
const news = document.querySelector('#news')
|
||||
if (!news) {
|
||||
return
|
||||
}
|
||||
|
||||
const markedScript = document.createElement('script')
|
||||
markedScript.src = '/media/js/marked.min.js'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user