Skip to content

Commit ae65399

Browse files
removes type attribute from earlyHint helper. it will be reimplemented properly. (#193)
1 parent d0b70e2 commit ae65399

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

helpers/earlyHint.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ const factory = globals => {
66
return function (path, state) {
77
const options = arguments[arguments.length - 1];
88

9-
const type = options.hash.type;
109
const cors = options.hash.cors;
1110

1211
addResourceHint(
1312
globals,
1413
path,
1514
state,
16-
type,
15+
undefined,
1716
cors
1817
);
1918

spec/helpers/earlyHint.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,20 @@ const Lab = require('lab'),
66
const {buildRenderer, testRunner} = require("../spec-helpers");
77
const {expect} = require("code");
88
const {
9-
resourceHintAllowedTypes,
109
resourceHintAllowedStates,
1110
resourceHintAllowedCors
1211
} = require("../../helpers/lib/resourceHints");
1312

14-
function template(path, state, type, cors) {
15-
type = type ? `type="${type}"` : '';
13+
function template(path, state, cors) {
1614
cors = cors ? `cors="${cors}"` : '';
17-
return `{{ earlyHint "${path}" "${state}" ${type} ${cors} }}`;
15+
return `{{ earlyHint "${path}" "${state}" ${cors} }}`;
1816
}
1917

2018
function randommer(items) {
2119
return () => items[Math.floor(Math.random() * items.length)];
2220
}
2321

2422
const randomHintState = randommer(Object.values(resourceHintAllowedStates));
25-
const randomHintType = randommer(Object.values(resourceHintAllowedTypes));
2623
const randomCors = randommer(Object.values(resourceHintAllowedCors));
2724

2825
let renderer, runTests;
@@ -54,10 +51,9 @@ describe('earlyHint', () => {
5451

5552
it('should create a resource hint with all the properties', done => {
5653
const path = '/asset/theme.css'
57-
const type = randomHintType();
5854
const state = randomHintState();
5955
const cors = randomCors();
60-
const input = template(path, state, type, cors);
56+
const input = template(path, state, cors);
6157
runTests([
6258
{
6359
input,
@@ -66,7 +62,7 @@ describe('earlyHint', () => {
6662
], () => {
6763
const hints = renderer.getResourceHints();
6864
expect(hints).to.have.length(1);
69-
expect(hints[0]).to.equals({src: path, state, type, cors});
65+
expect(hints[0]).to.equals({src: path, state, cors});
7066
done();
7167
});
7268
});

0 commit comments

Comments
 (0)