-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,31 @@ | ||
/// <reference types="Cypress" /> | ||
|
||
let focusableElements; | ||
let current; | ||
var focusableElements; | ||
|
||
describe(`Tab-behavior at ${"docs"} (${"/docs"})`, () => { | ||
before(function() { | ||
cy.visit("/docs/security/overview"); | ||
cy.get("body"); | ||
cy.document().then(doc => { | ||
focusableElements = doc.querySelectorAll( | ||
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])' | ||
); | ||
// Cypress.env( | ||
// "focusableElements", | ||
// doc.querySelectorAll( | ||
// 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])' | ||
// ) | ||
// ); | ||
for (const [index, route] of Object.entries(Cypress.env("routes"))) { | ||
describe(`Tab-behavior at ${index} ${route}`, () => { | ||
before("Has tabbable elements", function() { | ||
cy.visit(route); | ||
cy.document().then(doc => { | ||
focusableElements = doc.querySelectorAll(Cypress.env("tabElements")); | ||
}); | ||
}); | ||
cy.log(focusableElements); | ||
// cy.log(Cypress.env("focusableElements")); | ||
}); | ||
it(`Doesnt act like a cunt`, function() { | ||
cy.log(focusableElements); | ||
}); | ||
for (let i = 0; i < focusableElements.length; i++) { | ||
it(`Element ${i}/${focusableElements.length}`, function() { | ||
// state = `Element ${i}/${Cypress.env("focusableElements").length}`; | ||
// cy.tab().invoke("attr", "class", "active"); | ||
// cy.tab().invoke("attr", "style", "background-color: rgba(255,0,0,0.25);"); | ||
cy.tab().then(element => { | ||
cy.log(element); | ||
current = element; | ||
it("Assigns indices to tabbable elements", function() { | ||
expect(focusableElements.length).to.be.at.least(1); | ||
cy.document().then(doc => { | ||
for (let i = 0; i < focusableElements.length; i++) { | ||
focusableElements[i].style.backgroundColor = "rgba(255,0,0,0.25)"; | ||
const rect = focusableElements[i].getBoundingClientRect(); | ||
var tip = doc.createElement("div"); | ||
tip.innerHTML = i; | ||
let style = `height:1.25rem;width:1.25rem;background:red;position:absolute;line-height:1;font-size:1.25rem;;top:${ | ||
rect.top | ||
}px;left:${rect.left + rect.width}px;`; | ||
tip.setAttribute("style", style); | ||
doc.body.style.position = "relative"; | ||
doc.body.appendChild(tip); | ||
} | ||
}); | ||
cy.log(current); | ||
|
||
// cy.document().then(doc => { | ||
// new LeaderLine(current, doc.querySelectorAll("a")[3]); | ||
// }); | ||
}); | ||
} | ||
}); | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// <reference types="Cypress" /> | ||
|
||
for (const [breakpoint, width] of Object.entries(Cypress.env("breakpoints"))) { | ||
for (const [index, route] of Object.entries(Cypress.env("routes"))) { | ||
describe(`Screenshot ${index} ${route}`, function() { | ||
before(function() { | ||
cy.visit(route); | ||
cy.viewport(width, 800); | ||
}); | ||
it(`Captures breakpoint: ${breakpoint}`, function() { | ||
cy.get("body") | ||
.first() | ||
.screenshot(`${width}/${index}`, { | ||
clip: { | ||
x: 0, | ||
y: 0, | ||
width: width, | ||
height: 800, | ||
}, | ||
}); | ||
}); | ||
}); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/// <reference types="Cypress" /> | ||
|
||
for (const [index, route] of Object.entries(Cypress.env("routes"))) { | ||
describe(`Screenshot ${index} ${route}`, function() { | ||
if (Object.keys(Cypress.env("landmarks")).includes(index)) { | ||
before(function() { | ||
cy.visit(route); | ||
cy.viewport(1000, 800); | ||
}); | ||
for (const [key, selector] of Object.entries( | ||
Cypress.env("landmarks")[index] | ||
)) { | ||
it(`Captures landmark: ${key}`, function() { | ||
cy.get(selector) | ||
.first() | ||
.screenshot(`${index}/${key}`, { | ||
clip: { | ||
x: 0, | ||
y: 0, | ||
width: 1000, | ||
height: 800, | ||
}, | ||
}); | ||
}); | ||
} | ||
} | ||
}); | ||
} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ | |
* @package Grav\Theme | ||
* @author Ole Vik <[email protected]> | ||
* @license http://www.opensource.org/licenses/mit-license.html MIT License | ||
* @link https://github.com/OleVik/grav-plugin-scholar | ||
* @link https://github.com/OleVik/grav-theme-scholar | ||
*/ | ||
class Scholar extends Theme | ||
{ | ||
|
@@ -67,8 +67,6 @@ public function onThemeInitialized() | |
if ($this->config->get('themes.scholar.enabled') != true) { | ||
return; | ||
} | ||
// dump(Utilities::filesFinder('user://data/persist', ['js'])); | ||
// dump(StaticGenerator::getSearchFiles('index')); | ||
$this->autoload(); | ||
if ($this->config->get('system.debugger.enabled')) { | ||
$this->grav['debugger']->startTimer('scholar', 'Scholar'); | ||
|
@@ -218,6 +216,26 @@ public function onPagesInitialized() | |
*/ | ||
public function onPageInitialized() | ||
{ | ||
if (isset($this->grav['page']->header()->theme) | ||
&& !empty($this->grav['page']->header()->theme) | ||
) { | ||
$this->grav['config']->set( | ||
'theme', | ||
array_merge( | ||
$this->grav['config']->get('theme'), | ||
$this->grav['page']->header()->theme | ||
) | ||
); | ||
} | ||
if ($this->grav['config']->get('theme.debug')) { | ||
$this->grav['assets']->addJs( | ||
$this->grav['locator']->findResource( | ||
'theme://node_modules/@khanacademy/tota11y/dist/tota11y.min.js', | ||
false, | ||
true | ||
) | ||
); | ||
} | ||
if ($this->grav['config']->get('theme.linked_data')) { | ||
$call = self::getInstance( | ||
$this->grav['config']->get( | ||
|
@@ -237,18 +255,6 @@ public function onPageInitialized() | |
$this->grav['config'] | ||
); | ||
} | ||
if (isset($this->grav['page']->header()->theme) | ||
&& !empty($this->grav['page']->header()->theme) | ||
) { | ||
$this->grav['config']->set( | ||
'theme', | ||
array_merge( | ||
$this->grav['config']->get('theme'), | ||
$this->grav['page']->header()->theme | ||
) | ||
); | ||
} | ||
// $ld = new $call($this->grav['language']); | ||
$call->buildSchema($this->grav['page']); | ||
$this->grav['assets']->addInlineJs( | ||
$call::getSchema( | ||
|