Skip to content

Commit

Permalink
Merge pull request #24 from dxw/fix/do-not-hardcode-assets
Browse files Browse the repository at this point in the history
Fix/do not hardcode assets
  • Loading branch information
RobjS authored Mar 11, 2021
2 parents c65b861 + 003f1e0 commit 8a57ae9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 26 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.2.1] - 2021-03-11

### Removed
- Superfluous meta tag and favicons that were printed directly into the page head, and could not be over-written.

## [v0.2.0] - 2021-02-23

### Added
Expand Down
12 changes: 0 additions & 12 deletions app/Theme/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public function __construct(\Dxw\Iguana\Theme\Helpers $helpers)
public function register()
{
add_action('wp_enqueue_scripts', [$this, 'wpEnqueueScripts']);
add_action('wp_print_scripts', [$this, 'wpPrintScripts']);
}

public function getAssetPath($path)
Expand Down Expand Up @@ -50,15 +49,4 @@ public function wpEnqueueScripts()

wp_enqueue_style('main', $this->getAssetPath('main.min.css'));
}

public function wpPrintScripts()
{
?>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="apple-touch-icon-precomposed" href="<?php $this->assetPath('img/apple-touch-icon-precomposed.png') ?>">

<link rel="icon" type="image/png" href="<?php $this->assetPath('img/shortcut-icon.png') ?>">
<?php
}
}
13 changes: 0 additions & 13 deletions spec/theme/scripts.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
it('registers nav scripts', function () {
allow('add_action')->toBeCalled();
expect('add_action')->toBeCalled()->once()->with('wp_enqueue_scripts', [$this->scripts, 'wpEnqueueScripts']);
expect('add_action')->toBeCalled()->once()->with('wp_print_scripts', [$this->scripts, 'wpPrintScripts']);

$this->scripts->register();
});
Expand Down Expand Up @@ -67,16 +66,4 @@
$this->scripts->wpEnqueueScripts();
});
});

describe('->wpPrintScripts()', function () {
it('prints some elements tags directly', function () {
allow('get_template_directory_uri')->toBeCalled()->andReturn('http://a.invalid/zzz');
ob_start();
$this->scripts->wpPrintScripts();
$result = ob_get_contents();
ob_end_clean();
expect(preg_match_all("/<meta .*>/", $result))->toEqual(1);
expect(preg_match_all("/<link .*>/", $result))->toEqual(2);
});
});
});
2 changes: 1 addition & 1 deletion templates/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Theme Name: GovukTheme
* Author: dxw
* Version: 0.2.0
* Version: 0.2.1
* Author URI: https://www.dxw.com/
* License: MIT
* License URI: https://opensource.org/licenses/MIT
Expand Down

0 comments on commit 8a57ae9

Please sign in to comment.