Skip to content

Commit

Permalink
⬆️ v3.9.0...v3.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nadnoslen committed Apr 18, 2022
1 parent 8cddf6b commit 280427c
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2017,
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['ember'],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set Node.js
uses: actions/setup-node@master
with:
node-version: 10.24.1
node-version: 12.22.8

- name: Get yarn cache
id: yarn-cache
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 10.24.1
nodejs 12.22.8
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- '6'
- '8'

sudo: false
dist: trusty
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ a _vanilla_ port of Gruber's original works.

- Ember.js v2.18 or above
- Ember CLI v2.13 or above
- Node.js v8 or above

## Installation

Expand Down
3 changes: 3 additions & 0 deletions addon/components/set-links-target.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export default Component.extend({
// got this far, then apply a target if it hasn't already got one
if (isEmpty(element.getAttribute('target'))) {
element.setAttribute('target', targetValue);
if (targetValue === '_blank') {
element.setAttribute('rel', 'noopener noreferrer');
}
}
});
},
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"dependencies": {
"ember-auto-import": "^1.5.3",
"ember-cli-babel": "^7.26.11",
"ember-cli-htmlbars": "^3.0.0",
"ember-cli-htmlbars": "^3.0.1",
"lodash.startswith": "^4.2.1",
"showdown": "^1.9.1"
},
Expand All @@ -59,7 +59,7 @@
"bootstrap-sass": "^3.4.3",
"bootswatch": "^3.4.1",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.9.0",
"ember-cli": "~3.10.1",
"ember-cli-dependency-checker": "^3.1.0",
"ember-cli-deploy": "^1.0.2",
"ember-cli-deploy-build": "^2.0.0",
Expand All @@ -79,7 +79,7 @@
"ember-maybe-import-regenerator": "^0.1.6",
"ember-qunit": "^4.6.0",
"ember-resolver": "^8.0.3",
"ember-source": "~3.9.0",
"ember-source": "~3.10.0",
"ember-source-channel-url": "^3.0.0",
"ember-try": "^2.0.0",
"eslint-plugin-ember": "^7.0.0",
Expand All @@ -91,7 +91,7 @@
"sass": "~1.48.0"
},
"engines": {
"node": "6.* || 8.* || >= 10.*"
"node": "8.* || >= 10.*"
},
"ember-addon": {
"configPath": "tests/dummy/config"
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/config/ember-cli-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages": [
{
"name": "ember-cli",
"version": "3.9.0",
"version": "3.10.1",
"blueprints": [
{
"name": "addon",
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/components/set-links-target-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,24 @@ module('Integration | Component | set links target', function (hooks) {
assert.equal(find('.set-links-target').innerHTML.trim(), '<h3 id="heading3">Heading 3</h3>');
});

test('when the yield link(s) have target set to _top', async function (assert) {
await render(hbs`
{{#set-links-target targetValue="_top"}}
{{marked-down "[Some Link](http://github.com)"}}
{{/set-links-target}}
`);
assert.dom('a').hasAttribute('target', '_top');
assert.dom('a').hasNoAttribute('rel');
});

test('when the yields link(s) do not have a target value, _blank is added', async function (assert) {
await render(hbs`
{{#set-links-target}}
{{marked-down "[Some Link](http://github.com)"}}
{{/set-links-target}}
`);
assert.dom('a').hasAttribute('target', '_blank');
assert.dom('a').hasAttribute('rel', 'noopener noreferrer');
});

test('when excludeSelfLinks is false, the target is applied to local links', async function (assert) {
Expand All @@ -36,6 +47,7 @@ module('Integration | Component | set links target', function (hooks) {
{{/set-links-target}}
`);
assert.dom('a').hasAttribute('target', '_blank');
assert.dom('a').hasAttribute('rel', 'noopener noreferrer');
});

test('when excludeSelfLinks defaults to true, the target is not applied to such links', async function (assert) {
Expand All @@ -46,6 +58,7 @@ module('Integration | Component | set links target', function (hooks) {
{{/set-links-target}}
`);
assert.dom('a').hasNoAttribute('target');
assert.dom('a').hasNoAttribute('rel');
});

test('when excludeSelfLinks is explicitly set to true, the target is not applied to such links', async function (assert) {
Expand All @@ -56,6 +69,7 @@ module('Integration | Component | set links target', function (hooks) {
{{/set-links-target}}
`);
assert.dom('a').hasNoAttribute('target');
assert.dom('a').hasNoAttribute('rel');
});

test('when the target is set for one of several links', async function (assert) {
Expand All @@ -66,6 +80,8 @@ module('Integration | Component | set links target', function (hooks) {
{{/set-links-target}}
`);
assert.dom('a').hasNoAttribute('target');
assert.dom('a').hasNoAttribute('rel');
assert.dom(findAll('a')[1]).hasAttribute('target', '_blank');
assert.dom(findAll('a')[1]).hasAttribute('rel', 'noopener noreferrer');
});
});
Loading

0 comments on commit 280427c

Please sign in to comment.