feat: embed canonical presentation on homepage
Build and publish Eldorado documentation / build (pull_request) Successful in 42s
Build and publish Eldorado documentation / build (pull_request) Successful in 42s
This commit is contained in:
1 parent
432370473d
commit
8a9363ccb2
10 files changed
+171
-10
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {readFileSync} from 'node:fs';
|
||||
import vm from 'node:vm';
|
||||
function runtime(search) {
|
||||
let config; const classes=new Set(); const links=[{}];
|
||||
const document={documentElement:{classList:{toggle:(name,on)=>on?classes.add(name):classes.delete(name)}},getElementById:()=>({addEventListener(){},hidden:false}),querySelector:()=>({hidden:false}),querySelectorAll:()=>links,hasFocus:()=>true};
|
||||
const window={matchMedia:()=>({matches:false,addEventListener(){}})};
|
||||
vm.runInNewContext(read('presentations/less-prompting-more-shipping/runtime.js'),{window,document,location:{search},URLSearchParams,RevealNotes:{},Reveal:{initialize:c=>{config=c;},configure(){}}});
|
||||
return {config,classes,links};
|
||||
}
|
||||
test('embed isolates URL, focus and deck links without autoplay; print stays standalone',()=>{
|
||||
const embed=runtime('?embed');
|
||||
assert.equal(embed.config.hash,false);
|
||||
assert.equal(embed.config.embedded,true);
|
||||
assert.equal(embed.config.autoSlide,0);
|
||||
assert.equal(embed.config.keyboard[70],null);
|
||||
assert.equal(embed.config.keyboard[83],null);
|
||||
assert.equal(typeof embed.config.keyboardCondition,'function');
|
||||
assert(embed.classes.has('embedded'));
|
||||
assert.equal(embed.links[0].target,'_top');
|
||||
for(const query of ['', '?print-pdf', '?embed&print-pdf']) {
|
||||
const {config,classes}=runtime(query);
|
||||
assert.equal(config.hash,true);assert(!classes.has('embedded'));
|
||||
}
|
||||
});
|
||||
const read=p=>readFileSync(p,'utf8');
|
||||
test('homepage replaces teaser with titled single-source playable stage below existing cards',()=>{
|
||||
const home=read('src/pages/index.tsx');
|
||||
assert.match(home,/<div className="section-heading"><div><h2 id="presentation-title">Understand In Speed<\/h2>/);
|
||||
assert(home.indexOf('Understand In Speed')>home.indexOf('Shaping the direction.'));
|
||||
assert.match(home,/<PresentationEmbed/);
|
||||
assert(!home.includes('35-minute presentation'));
|
||||
const component=read('src/components/PresentationEmbed/index.tsx');
|
||||
assert.match(component,/<iframe/);assert.match(component,/title=/);assert.match(component,/\?embed/);
|
||||
assert.match(component,/allowFullScreen/);
|
||||
});
|
||||
Reference in new issue
Block a user