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

feat: Update menu items & improve whitespace #2084

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions src/components/Menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ const meta = compile(`
</svg>

<div id=d>
<a href=chrome://new-tab-page>Open Default Tab</a>
<a href=chrome://bookmarks>Bookmarks Manager</a>
<a href=chrome://bookmarks>Bookmarks</a>
<a href=chrome://password-manager>Passwords</a>
<a href=chrome://downloads>Downloads</a>
<a href=chrome://history>History</a>
<a href=chrome://password-manager>Passwords</a>
<a href=chrome://extensions>Extensions</a>

<hr>

Expand Down
2 changes: 1 addition & 1 deletion src/css/newtab.xcss
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ hr {
#d {
position: absolute;
top: 10px;
padding: 18px;
padding: 9px 23px; // 9px = half of font-size
background: var(--c2);
box-shadow: var(--s);
opacity: 0;
Expand Down
3 changes: 1 addition & 2 deletions src/css/themes/neon-dreams.xcss
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ button {
}

hr {
margin-right: -18px;
margin-left: -18px;
margin: 9px -23px; // 9px = half of font-size
}

h2,
Expand Down
22 changes: 11 additions & 11 deletions test/unit/Menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ afterEach(cleanup);

test('rendered DOM contains expected elements', () => {
const rendered = render(Menu());
expect(rendered.container.querySelector('#m')).toBeTruthy();
expect(rendered.container.querySelector('svg#im')).toBeTruthy();
expect(rendered.container.querySelector('#d')).toBeTruthy();
expect(rendered.container.querySelector('a[href="chrome://new-tab-page"]')).toBeTruthy();
expect(rendered.container.querySelector('a[href="chrome://bookmarks"]')).toBeTruthy();
expect(rendered.container.querySelector('a[href="chrome://downloads"]')).toBeTruthy();
expect(rendered.container.querySelector('a[href="chrome://history"]')).toBeTruthy();
expect(rendered.container.querySelector('a[href="chrome://password-manager"]')).toBeTruthy();
expect(
rendered.container.querySelector('a[href="https://github.com/maxmilton/new-tab/issues"]'),
).toBeTruthy();
const root = rendered.container.firstChild as HTMLElement;
expect(root).toBeInstanceOf(window.HTMLDivElement);
expect(root.id).toBe('m');
expect(root.querySelector('svg#im')).toBeTruthy();
expect(root.querySelector('div#d')).toBeTruthy();
expect(root.querySelector('a[href="chrome://bookmarks"]')).toBeTruthy();
expect(root.querySelector('a[href="chrome://password-manager"]')).toBeTruthy();
expect(root.querySelector('a[href="chrome://downloads"]')).toBeTruthy();
expect(root.querySelector('a[href="chrome://history"]')).toBeTruthy();
expect(root.querySelector('a[href="chrome://extensions"]')).toBeTruthy();
expect(root.querySelector('a[href="https://github.com/maxmilton/new-tab/issues"]')).toBeTruthy();
});

test('rendered DOM matches snapshot', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/__snapshots__/Menu.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Bun Snapshot v1, https://goo.gl/fbAQLP

exports[`rendered DOM matches snapshot 1`] = `"<div id="m"><svg id="im"><path d="M4 6h16M4 12h16M4 18h16"></path></svg><div id="d"><a href="chrome://new-tab-page">Open Default Tab</a><a href="chrome://bookmarks">Bookmarks Manager</a><a href="chrome://downloads">Downloads</a><a href="chrome://history">History</a><a href="chrome://password-manager">Passwords</a><hr><a>New Tab Settings</a><a href="https://github.com/maxmilton/new-tab/issues">Report Bug</a></div></div>"`;
exports[`rendered DOM matches snapshot 1`] = `"<div id="m"><svg id="im"><path d="M4 6h16M4 12h16M4 18h16"></path></svg><div id="d"><a href="chrome://bookmarks">Bookmarks</a><a href="chrome://password-manager">Passwords</a><a href="chrome://downloads">Downloads</a><a href="chrome://history">History</a><a href="chrome://extensions">Extensions</a><hr><a>New Tab Settings</a><a href="https://github.com/maxmilton/new-tab/issues">Report Bug</a></div></div>"`;