Skip to content

Commit

Permalink
✨ Added Koenig bookmark kard CSS rules
Browse files Browse the repository at this point in the history
TryGhost/Ghost#11024

- 10 bookmark card rules have landed in Ghost as of 2.30.0 release, so they need to be checked for in v2 onwards
  • Loading branch information
naz committed Sep 19, 2019
1 parent 2ebd9fe commit 128b0eb
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 6 deletions.
90 changes: 90 additions & 0 deletions lib/specs/v2.js
Expand Up @@ -498,6 +498,96 @@ let rules = {
className: '.kg-gallery-image',
css: true
},
'GS050-CSS-KGBM': {
level: 'error',
rule: 'The <code>.kg-bookmark-card</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-card</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-card/g,
className: '.kg-bookmark-card',
css: true
},
'GS050-CSS-KGBMCO': {
level: 'error',
rule: 'The <code>.kg-bookmark-container</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-card</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-container/g,
className: '.kg-bookmark-container',
css: true
},
'GS050-CSS-KGBMCON': {
level: 'error',
rule: 'The <code>.kg-bookmark-content</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-content</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-content/g,
className: '.kg-bookmark-content',
css: true
},
'GS050-CSS-KGBMTI': {
level: 'error',
rule: 'The <code>.kg-bookmark-title</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-title</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-title/g,
className: '.kg-bookmark-title',
css: true
},
'GS050-CSS-KGBMDE': {
level: 'error',
rule: 'The <code>.kg-bookmark-description</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-description</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-description/g,
className: '.kg-bookmark-description',
css: true
},
'GS050-CSS-KGBMME': {
level: 'error',
rule: 'The <code>.kg-bookmark-metadata</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-metadata</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-metadata/g,
className: '.kg-bookmark-metadata',
css: true
},
'GS050-CSS-KGBMIC': {
level: 'error',
rule: 'The <code>.kg-bookmark-icon</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-icon</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-icon/g,
className: '.kg-bookmark-icon',
css: true
},
'GS050-CSS-KGBMAU': {
level: 'error',
rule: 'The <code>.kg-bookmark-author</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-author</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-author/g,
className: '.kg-bookmark-author',
css: true
},
'GS050-CSS-KGBMPU': {
level: 'error',
rule: 'The <code>.kg-bookmark-publisher</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-publisher</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-publisher/g,
className: '.kg-bookmark-publisher',
css: true
},
'GS050-CSS-KGBMTH': {
level: 'error',
rule: 'The <code>.kg-bookmark-thumbnail</code> CSS class is required to appear styled in your theme',
details: oneLineTrim`The <code>.kg-bookmark-thumbnail</code> CSS class is required otherwise the bookmark card will appear unstyled without it.
Find out more about required theme changes for the Koenig editor <a href="${docsBaseUrl}editor/#bookmark-card" target=_blank>here</a>.`,
regex: /\.kg-bookmark-thumbnail/g,
className: '.kg-bookmark-thumbnail',
css: true
},
// Updated v1 rules
'GS001-DEPR-AC': {
rule: 'Replace the <code>{{author.cover}}</code> helper with <code>{{primary_author.cover_image}}</code>',
Expand Down
4 changes: 2 additions & 2 deletions test/050-koenig-css-classes.test.js
Expand Up @@ -87,7 +87,7 @@ describe('050 Koenig CSS classes', function () {
utils.testCheck(thisCheck, '050-koenig-css-classes/valid').then(function (output) {
output.should.be.a.ValidThemeObject();

output.results.pass.should.be.an.Array().with.lengthOf(5);
output.results.pass.should.be.an.Array().with.lengthOf(15);

output.results.fail.should.be.an.Object().which.is.empty();

Expand Down Expand Up @@ -167,7 +167,7 @@ describe('050 Koenig CSS classes', function () {
utils.testCheck(thisCheck, '050-koenig-css-classes/valid', options).then(function (output) {
output.should.be.a.ValidThemeObject();

output.results.pass.should.be.an.Array().with.lengthOf(5);
output.results.pass.should.be.an.Array().with.lengthOf(15);

output.results.fail.should.be.an.Object().which.is.empty();

Expand Down
13 changes: 12 additions & 1 deletion test/fixtures/themes/050-koenig-css-classes/valid/assets/my.css
Expand Up @@ -3,4 +3,15 @@

.kg-gallery-container {}
.kg-gallery-row {}
.kg-gallery-image {}
.kg-gallery-image {}

.kg-bookmark-card {}
.kg-bookmark-container {}
.kg-bookmark-content {}
.kg-bookmark-title {}
.kg-bookmark-description {}
.kg-bookmark-metadata {}
.kg-bookmark-icon {}
.kg-bookmark-author {}
.kg-bookmark-publisher {}
.kg-bookmark-thumbnail {}
6 changes: 3 additions & 3 deletions test/general.test.js
Expand Up @@ -552,7 +552,7 @@ describe('format', function () {
checker(themePath('005-compile/invalid')).then((theme) => {
theme = format(theme);

theme.results.error.length.should.eql(16);
theme.results.error.length.should.eql(26);
theme.results.error[0].fatal.should.eql(true);
// theme.results.error[1].fatal.should.eql(true);
// theme.results.error[2].fatal.should.eql(true);
Expand Down Expand Up @@ -590,7 +590,7 @@ describe('format', function () {
theme.results.warning.all.length.should.eql(3);
theme.results.warning.byFiles['default.hbs'].length.should.eql(2);

theme.results.error.all.length.should.eql(16);
theme.results.error.all.length.should.eql(26);

// 1 rule has file references
theme.results.error.byFiles['author.hbs'].length.should.eql(1);
Expand All @@ -612,7 +612,7 @@ describe('format', function () {
theme.results.recommendation.all.length.should.eql(2);
theme.results.recommendation.byFiles['package.json'].length.should.eql(1);

theme.results.error.all.length.should.eql(88);
theme.results.error.all.length.should.eql(98);
theme.results.warning.all.length.should.eql(5);

theme.results.error.byFiles['assets/my.css'].length.should.eql(3);
Expand Down

0 comments on commit 128b0eb

Please sign in to comment.