Skip to content

Commit

Permalink
feat: Update menu items & improve whitespace (#2084)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmilton committed Dec 4, 2023
1 parent 845f1d6 commit acc5a7a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
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>"`;

0 comments on commit acc5a7a

Please sign in to comment.