Ghost/core/test/unit
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
..
adapters Removed superagent dependency (#10535) 2019-03-04 15:59:38 +08:00
api 🐛 Fixed field filtering for /authors/:id endpoints 2019-03-05 15:18:32 +08:00
apps 🐛 Fixed empty amp page 2019-02-27 17:56:09 +01:00
config Removed old jshint/jscs rules 2018-06-02 21:48:23 +02:00
data Added members permission migrations 2019-02-26 15:43:36 +07:00
helpers 🐛 Fixed img-url to output relative url by default (#10596) 2019-03-11 15:20:05 +01:00
lib Updated mobiledoc renderer to insert begin/end HTML comments around cards 2019-02-25 18:05:01 +07:00
models 🐛 Fixed private blogging getting enabled when saving any setting (#10576) 2019-03-06 12:56:26 +01:00
public Refactored Ghost SDK unit test 2018-10-05 16:49:46 +02:00
services 🐛 Fixed v0.1 username/password authentication 2019-03-06 10:48:21 +01:00
web Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00
filters_spec.js Bumped sinon from 4.4.6 to 7.3.2 (#10400) 2019-01-21 17:53:44 +01:00