[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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
toHaveLength
  • Loading branch information
connorjclark committed Jul 18, 2019
commit d61a5ff3fd9b50905a4bf89ceac8a04f18eff4ce
8 changes: 4 additions & 4 deletions lighthouse-core/test/audits/seo/font-size-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ describe('SEO: Font size audit', () => {
});

describe('attributes source location', () => {
function runFontSizeAuditWithSingleFailingStyle(style, nodeProperties) {
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)

MetaElements: makeMetaElements(validViewport),
Expand All @@ -250,7 +250,9 @@ describe('SEO: Font size audit', () => {
},
TestedAsMobileDevice: true,
};
return FontSizeAudit.audit(artifacts, getFakeContext());
const auditResult = await FontSizeAudit.audit(artifacts, getFakeContext());
expect(auditResult.details.items).toHaveLength(1);
return auditResult;
}

it('to inline node stylesheet', async () => {
Expand All @@ -262,7 +264,6 @@ describe('SEO: Font size audit', () => {
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

assert.equal(auditResult.details.items.length, 1);
expect(auditResult.details.items[0].selector).toMatchObject({
type: 'node',
selector: '#my-parent',
Expand All @@ -279,7 +280,6 @@ describe('SEO: Font size audit', () => {
attributes: ['size', '10px'],
});

assert.equal(auditResult.details.items.length, 1);
expect(auditResult.details.items[0].selector).toMatchObject({
type: 'node',
selector: '#my-parent',
Expand Down