From 007ab4f9dcb41937cc35bb1e569bf48904cbb3db Mon Sep 17 00:00:00 2001 From: IreneStr Date: Mon, 6 Nov 2017 15:40:58 +0100 Subject: [PATCH] Escape keyword in url and add spec --- spec/bundledPlugins/previouslyUsedKeywordsSpec.js | 6 ++++++ src/bundledPlugins/previouslyUsedKeywords.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/bundledPlugins/previouslyUsedKeywordsSpec.js b/spec/bundledPlugins/previouslyUsedKeywordsSpec.js index bfae20a72..990f1ac6f 100644 --- a/spec/bundledPlugins/previouslyUsedKeywordsSpec.js +++ b/spec/bundledPlugins/previouslyUsedKeywordsSpec.js @@ -33,6 +33,12 @@ describe( "checks for keyword doubles", function(){ expect( plugin.scoreAssessment( {id: 0, count: 0}, paper, i18n ).score ).toBe( 9 ); expect( plugin.scoreAssessment( {id: 0, count: 0}, paper, i18n ).text ).toBe( "You've never used this focus keyword before, very good." ); }); + + it("escapes the keyword's special characters in the url", function(){ + var paper = new Paper( "text", { keyword: "keyword/bla"} ); + var plugin = new PreviouslyUsedKeywords( app, args, i18n ); + expect( plugin.scoreAssessment({id: 1, count: 2 }, paper, i18n ).text ).toBe( "You've used this focus keyword 2 times before, it's probably a good idea to read this post on cornerstone content and improve your keyword strategy." ); + }); }); describe( "checks for keyword doubles", function(){ diff --git a/src/bundledPlugins/previouslyUsedKeywords.js b/src/bundledPlugins/previouslyUsedKeywords.js index f9e44a6c9..8989345a4 100644 --- a/src/bundledPlugins/previouslyUsedKeywords.js +++ b/src/bundledPlugins/previouslyUsedKeywords.js @@ -80,7 +80,7 @@ PreviouslyUsedKeyword.prototype.scoreAssessment = function( previouslyUsedKeywor }; } if ( count > 1 ) { - url = ""; + url = ""; return { /* Translators: %1$s and $3$s expand to the admin search page for the focus keyword, %2$d expands to the number of times this focus keyword has been used before, %4$s and %5$s expand to a link to an article on yoast.com about cornerstone content */