Skip to content
Snippets Groups Projects
Verified Commit 62498926 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3400359 by el7cosmos, dinazaur, alexpott, ReINFaTe: External fonts...

Issue #3400359 by el7cosmos, dinazaur, alexpott, ReINFaTe: External fonts cannot be loaded via add_css ajax command
parent a2f51b88
No related branches found
No related tags found
No related merge requests found
......@@ -1716,7 +1716,8 @@
const allUniqueBundleIds = response.data.map(function (style) {
const uniqueBundleId = style.href + ajax.instanceIndex;
loadjs(style.href, uniqueBundleId, {
// Force file to load as a CSS stylesheet using 'css!' flag.
loadjs(`css!${style.href}`, uniqueBundleId, {
before(path, styleEl) {
// This allows all attributes to be added, like media.
Object.keys(style).forEach((attributeKey) => {
......
......@@ -207,6 +207,10 @@ function ajax_forms_test_advanced_commands_add_css_callback($form, FormStateInte
'href' => 'my/file.css',
'media' => 'all',
],
[
'href' => 'https://example.com/css?family=Open+Sans',
'media' => 'all',
],
]));
return $response;
}
......
......@@ -38,6 +38,8 @@ public function testAjaxCommands() {
// Tests the 'add_css' command.
$page->pressButton("AJAX 'add_css' command");
$this->assertWaitPageContains('my/file.css');
$this->assertSession()->elementExists('css', 'link[href="my/file.css"]');
$this->assertSession()->elementExists('css', 'link[href="https://example.com/css?family=Open+Sans"]');
// Tests the 'after' command.
$page->pressButton("AJAX 'After': Click to put something after the div");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment