-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(meta-viewport): show attribute in message #1061
Conversation
c86df60
to
9538e81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm.
@@ -26,10 +26,12 @@ if ( | |||
} | |||
|
|||
if (!lowerBound && result['user-scalable'] === 'no') { | |||
this.data(['user-scalable=no']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this an array? Is so should we do a join in the doT templates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd followed another example, there can only be one result but that looked like what doT was expecting.
return false; | ||
} | ||
|
||
if (result['maximum-scale'] && parseFloat(result['maximum-scale']) < minimum) { | ||
this.data(['maximum-scale']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we saying if user-scalable=no
is already set on data, maximum-scale
will then override the data? Should we not concat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns false. There can only be one result.
lib/checks/mobile/meta-viewport.json
Outdated
@@ -8,7 +8,7 @@ | |||
"impact": "critical", | |||
"messages": { | |||
"pass": "<meta> tag does not disable zooming on mobile devices", | |||
"fail": "<meta> tag disables zooming on mobile devices" | |||
"fail": "{{~it.data:value}} {{=value}}{{~}} on <meta> tag disables zooming on mobile devices" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data seems to be an array, values should be joined here to construct the string...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}); | ||
describe('; separator', function() { | ||
it('should return false on user-scalable=no', function() { | ||
fixture.innerHTML = | ||
'<meta name="viewport" content="foo=bar, cats=dogs, user-scalable=no">'; | ||
var node = fixture.querySelector('meta'); | ||
|
||
assert.isFalse(checks['meta-viewport'].evaluate(node)); | ||
assert.isFalse(checks['meta-viewport'].evaluate.call(checkContext, node)); | ||
assert.deepEqual(checkContext._data, ['user-scalable=no']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a test case where both user-scalable
and maximum-scale
are added to _data
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
3dabe65
to
f30fefa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment.
f30fefa
to
713c481
Compare
713c481
to
545dfaa
Compare
@WilcoFiers good catch, I've updated the PR and rebased from develop. |
@marcysutton seems like we should add some tests to ensure that the appropriate data is coming through? |
@dylanb not a bad idea, do you know of any existing places in the codebase where we test the messages? |
A user reported the meta-viewport check had a confusing failure message, so I changed it to pass along the failing attribute:
"Fix the following: user-scalable="no" on tag disables zooming"
Closes #1045
Reviewer checks
Required fields, to be filled out by PR reviewer(s)