[go: nahoru, domu]

Skip to content
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

tests(font-size): add test for attributing styles to node #9400

Merged
merged 8 commits into from
Jul 18, 2019

Conversation

connorjclark
Copy link
Collaborator

I noticed that the URL artifact for font-size-test was invalid. Fixed it - but there were also no tests that used it. So I made one that covers attributing styles to nodes.

types/artifacts.d.ts Outdated Show resolved Hide resolved
Copy link
Collaborator
@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ain't gonna complain about more tests! :)

LGTM

types/artifacts.d.ts Outdated Show resolved Hide resolved

const auditResult = await FontSizeAudit.audit(artifacts, getFakeContext());
assert.equal(auditResult.details.items.length, 2);
assert.equal(auditResult.details.items[0].source, URL.finalUrl);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(auditResult.details.items).toMatchObject

for the new stuff? :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Also, I grabbed the describe fn I made in #9354 and moved it here. 1) will make the other review smaller 2) doing the same stuff here.

Copy link
Collaborator
@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still LGTM!

lighthouse-core/test/audits/seo/font-size-test.js Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to staging July 18, 2019 22:54 Inactive
Copy link
Member
@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it - but there were also no tests that used it. So I made one that covers attributing styles to nodes.

neither of these are asserting source, though? Or at least one back to a URL

Also, maybe it's just the nature of the artifact, but these are pretty inscrutable test cases :) What on earth is type 'Attributes'?

describe('attributes source location', () => {
async function runFontSizeAuditWithSingleFailingStyle(style, nodeProperties) {
const artifacts = {
URL: {finalUrl: 'http://www.example.com'},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also not a valid URL artifact :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to make artifacts in tests fully complete, or just the parts we need for the test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to make artifacts in tests fully complete, or just the parts we need for the test?

not necessarily, I just found it funny :)

(URL is declared at the top level, though, so could be reused like validViewport is)

localName: 'p',
attributes: ['class', 'my-p'],
});

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my gosh wait yeah this file is completely different!

I'm sorry @connorjclark I got confused between two different font-size-test changes and approved this immediately after looking at the other one, too many reviews today my b 😢

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a separate review ongoing with runFontSizeAuditWithSingleFailingStyle...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you even tried to warn me over chat and it didn't work! 😆

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, this was it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, this was it.

there was one in #9354, though? #9400 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes... and I moved it here and asked patrick to review over chat :) a flawless system as you see

@connorjclark
Copy link
Collaborator Author

Also, maybe it's just the nature of the artifact, but these are pretty inscrutable test cases :) What on earth is type 'Attributes'?

It's a css rule that was applied via a dom attribute <font size="10px">. At least, in theory. I've just noticed that the gatherer doesn't seem to ever set type to Attributes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants