Skip to content

Commit

Permalink
fix jquery in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Jun 15, 2021
1 parent 90f5635 commit d90b28a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/unit/Grav/Common/AssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,15 @@ public function testAddingJSAssetPropertiesWithArrayFromCollection(): void
$this->assets->reset();
$this->assets->addJs('jquery', ['loading' => 'async']);
$js = $this->assets->js();
self::assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" async></script>' . PHP_EOL, $js);
self::assertSame('<script src="/system/assets/jquery/jquery-3.x.min.js" async></script>' . PHP_EOL, $js);

//Test priority too
$this->assets->reset();
$this->assets->addJs('jquery', ['loading' => 'async', 'priority' => 1]);
$this->assets->addJs('test.js', ['loading' => 'async', 'priority' => 2]);
$js = $this->assets->js();
self::assertSame('<script src="/test.js" async></script>' . PHP_EOL .
'<script src="/system/assets/jquery/jquery-2.x.min.js" async></script>' . PHP_EOL, $js);
'<script src="/system/assets/jquery/jquery-3.x.min.js" async></script>' . PHP_EOL, $js);

//Test multiple groups
$this->assets->reset();
Expand All @@ -357,15 +357,15 @@ public function testAddingJSAssetPropertiesWithArrayFromCollection(): void
$js = $this->assets->js();
self::assertSame('<script src="/test.js" async></script>' . PHP_EOL, $js);
$js = $this->assets->js('footer');
self::assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" async></script>' . PHP_EOL, $js);
self::assertSame('<script src="/system/assets/jquery/jquery-3.x.min.js" async></script>' . PHP_EOL, $js);

//Test adding array of assets
//Test priority too
$this->assets->reset();
$this->assets->addJs(['jquery', 'test.js'], ['loading' => 'async']);
$js = $this->assets->js();

self::assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" async></script>' . PHP_EOL .
self::assertSame('<script src="/system/assets/jquery/jquery-3.x.min.js" async></script>' . PHP_EOL .
'<script src="/test.js" async></script>' . PHP_EOL, $js);
}

Expand Down Expand Up @@ -626,15 +626,15 @@ public function testAddAsyncJs(): void
$this->assets->reset();
$this->assets->addAsyncJs('jquery');
$js = $this->assets->js();
self::assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" async></script>' . PHP_EOL, $js);
self::assertSame('<script src="/system/assets/jquery/jquery-3.x.min.js" async></script>' . PHP_EOL, $js);
}

public function testAddDeferJs(): void
{
$this->assets->reset();
$this->assets->addDeferJs('jquery');
$js = $this->assets->js();
self::assertSame('<script src="/system/assets/jquery/jquery-2.x.min.js" defer></script>' . PHP_EOL, $js);
self::assertSame('<script src="/system/assets/jquery/jquery-3.x.min.js" defer></script>' . PHP_EOL, $js);
}

public function testTimestamps(): void
Expand Down Expand Up @@ -716,7 +716,7 @@ public function testGetCollections(): void
{
self::assertIsArray($this->assets->getCollections());
self::assertContains('jquery', array_keys($this->assets->getCollections()));
self::assertContains('system://assets/jquery/jquery-2.x.min.js', $this->assets->getCollections());
self::assertContains('system://assets/jquery/jquery-3.x.min.js', $this->assets->getCollections());
}

public function testExists(): void
Expand Down

0 comments on commit d90b28a

Please sign in to comment.