Skip to content

Commit

Permalink
test: fixes unit tests checking padding after altering styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Stacy committed Sep 11, 2024
1 parent 640a58f commit 8093941
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 48 deletions.
154 changes: 154 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@types/eslint__js": "^8.42.3",
"@types/eslint-config-prettier": "^6.11.3",
"@types/jsdom": "^21.1.7",
"@vitest/ui": "^2.0.5",
"@vuepress/bundler-vite": "^2.0.0-rc.7",
"@vuepress/plugin-markdown-container": "^2.0.0-rc.42",
"@vuepress/theme-default": "^2.0.0-rc.11",
Expand Down
14 changes: 7 additions & 7 deletions test/filters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('log filtering', () => {

const logLeader = '%c Log';
const logStyle =
'font-size: 12px; border-radius: 4px; padding-right: 60px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;';
'font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;';

expect(console.log).toHaveBeenNthCalledWith(1, logLeader, logStyle, '#bar ', 'Included');
expect(console.log).toHaveBeenCalledTimes(1);
Expand All @@ -127,7 +127,7 @@ describe('log filtering', () => {

const logLeader = '%c Log';
const logStyle =
'font-size: 12px; border-radius: 4px; padding-right: 60px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;';
'font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;';

expect(console.log).toHaveBeenNthCalledWith(1, logLeader, logStyle, '#foo ', 'Included');
expect(console.log).toHaveBeenNthCalledWith(2, logLeader, logStyle, '#baz ', 'Included');
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('log filtering', () => {

const logLeader = '%c Log';
const logStyle =
'font-size: 12px; border-radius: 4px; padding-right: 60px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;';
'font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;';

expect(console.log).toHaveBeenNthCalledWith(1, logLeader, logStyle, '[bar] ', 'Included');
expect(console.log).toHaveBeenCalledTimes(1);
Expand All @@ -180,7 +180,7 @@ describe('log filtering', () => {

const logLeader = '%c Log';
const logStyle =
'font-size: 12px; border-radius: 4px; padding-right: 60px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;';
'font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;';

expect(console.log).toHaveBeenNthCalledWith(1, logLeader, logStyle, '[foo] ', 'Included');
expect(console.log).toHaveBeenNthCalledWith(2, logLeader, logStyle, '[baz] ', 'Included');
Expand Down Expand Up @@ -208,7 +208,7 @@ describe('log filtering', () => {

const logLeader = '%c Info';
const logStyle =
'padding-right: 52px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #d8ebff, #b2d7ff); color: #465464; border-color: #96b5d7;';
'padding-right: 44px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #d8ebff, #b2d7ff); color: #465464; border-color: #96b5d7;';

expect(console.info).toHaveBeenNthCalledWith(1, logLeader, logStyle, 'Included');
expect(console.error).not.toHaveBeenCalled();
Expand Down Expand Up @@ -238,14 +238,14 @@ describe('log filtering', () => {
expect(console.log).toHaveBeenNthCalledWith(
1,
'%c Log',
'font-size: 12px; border-radius: 4px; padding-right: 60px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;',
'font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;',
'Included'
);
expect(console.log).toHaveBeenCalledTimes(2);
expect(console.error).toHaveBeenNthCalledWith(
1,
'%c Alert',
'padding-right: 26px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fc8585, #fc2323); color: #fff; border-color: #b70101;',
'padding-right: 24px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fc8585, #fc2323); color: #fff; border-color: #b70101;',
'Included'
);
expect(console.info).not.toHaveBeenCalled();
Expand Down
Loading

0 comments on commit 8093941

Please sign in to comment.