0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/test/unit/helpers
Fabien O'Carroll a2aa66ca73
🐛 Fixed img-url to output relative url by default (#10596)
closes #10595

* Added breaking test for img-url helper

Input from the content API was absolute, adding this test to verify my fix

* Updated existing test to breaking test for img-url

Had made a dumb assumption when building images sizes, this updates the
test to fail so we can verify the fix

* Refactored img-url to return as early as possible

This makes it a little easier to parse what's going on, and it also
allows us to remove the check for existence of the image url in the
getImageSizes function

* Refactored img-url config parsing to clean up core logic

Superficial refactor to make future changes able to focus on what rather
than how.

* Refactored internal image detection into helper

We're gonna need to know if the image is internal or not, when we force
the path to relative, if we pull this out now, we have access in the top
level logic

* Removed duplicate checks for internal image

Cleaning up and moving "higher-level" logic into the main function of
the module

* Renamed attr -> requestedImageUrl

Superficial refactor, trying to be more explicit about identifiers

* 🐛 Fixed img-url to output relative url by default

Includes a check to isInternalImage as we never want to make external
images relative.

* Returned early if img-url recieves external url

After realising we never want to deal with external urls, we can
continue to return as early as possible, letting us remove checks and
simplify the more complex logic for internal images.

* Cleaned up the internal image logic

Defining the three functions in order helps to see what operations are
going to happen and in which order, we can then return the result of
each operation applied to the next operation.
2019-03-11 15:20:05 +01:00
..
test_tpl Attr pass-thru & full context in partial helpers 2019-03-09 21:21:01 +00:00
asset_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
author_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
authors_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
body_class_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
content_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
date_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
encode_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
excerpt_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
facebook_url_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
foreach_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
get_spec.js Renamed authors ctrl to authors-public 2019-02-26 08:33:10 +01:00
ghost_foot_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
ghost_head_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
has_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
img_url_spec.js 🐛 Fixed img-url to output relative url by default (#10596) 2019-03-11 15:20:05 +01:00
index_spec.js 🎨 Added additional parameters to subscribe_form and input_email helpers (#9820) 2018-08-30 17:17:27 +01:00
is_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
lang_spec.js 🔥 Drop Node v4 Support 2018-05-01 14:06:18 +02:00
meta_description_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
meta_title_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
navigation_spec.js Attr pass-thru & full context in partial helpers 2019-03-09 21:21:01 +00:00
next_post_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
page_url_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
pagination_spec.js Attr pass-thru & full context in partial helpers 2019-03-09 21:21:01 +00:00
plural_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
post_class_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
prev_post_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
reading_time_spec.js Changes for Koenig and Ghost 2.0 (#9750) 2018-08-16 12:13:24 +02:00
t_spec.js 🔥 Drop Node v4 Support 2018-05-01 14:06:18 +02:00
tags_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
template_spec.js Moved labs, auth, permissions, settings, mail, themes to services (#9339) 2017-12-14 03:01:23 +01:00
title_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
twitter_url_spec.js Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
url_spec.js 🐛 Supported "false" as absolute attribute value (#10556) 2019-03-04 11:23:42 +01:00
utils_spec.js Changes for Koenig and Ghost 2.0 (#9750) 2018-08-16 12:13:24 +02:00