diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-14 10:03:35 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-14 10:03:35 -0800 |
| commit | a4997a5fbc65913b55f2215eb3b868693bd76c51 (patch) | |
| tree | fe303ee7c5e5aba89f1c13766b14556f6e3d2f79 /frontend/coverage/src/App.tsx.html | |
| parent | 4d058d9ddb34f0e8d384b20d4b9e30f74d349129 (diff) | |
| download | neko-a4997a5fbc65913b55f2215eb3b868693bd76c51.tar.gz neko-a4997a5fbc65913b55f2215eb3b868693bd76c51.tar.bz2 neko-a4997a5fbc65913b55f2215eb3b868693bd76c51.zip | |
test: increase frontend coverage for Settings and improve FeedItem css
Diffstat (limited to 'frontend/coverage/src/App.tsx.html')
| -rw-r--r-- | frontend/coverage/src/App.tsx.html | 205 |
1 files changed, 119 insertions, 86 deletions
diff --git a/frontend/coverage/src/App.tsx.html b/frontend/coverage/src/App.tsx.html index ed02366..cd305cc 100644 --- a/frontend/coverage/src/App.tsx.html +++ b/frontend/coverage/src/App.tsx.html @@ -1,61 +1,68 @@ + <!doctype html> <html lang="en"> - <head> + +<head> <title>Code coverage report for src/App.tsx</title> <meta charset="utf-8" /> <link rel="stylesheet" href="../prettify.css" /> <link rel="stylesheet" href="../base.css" /> <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> - <style type="text/css"> - .coverage-summary .sorter { - background-image: url(../sort-arrow-sprite.png); - } + <style type='text/css'> + .coverage-summary .sorter { + background-image: url(../sort-arrow-sprite.png); + } </style> - </head> - - <body> - <div class="wrapper"> - <div class="pad1"> +</head> + +<body> +<div class='wrapper'> + <div class='pad1'> <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> App.tsx</h1> - <div class="clearfix"> - <div class="fl pad1y space-right2"> - <span class="strong">78.94% </span> - <span class="quiet">Statements</span> - <span class="fraction">15/19</span> - </div> - - <div class="fl pad1y space-right2"> - <span class="strong">66.66% </span> - <span class="quiet">Branches</span> - <span class="fraction">4/6</span> - </div> - - <div class="fl pad1y space-right2"> - <span class="strong">77.77% </span> - <span class="quiet">Functions</span> - <span class="fraction">7/9</span> - </div> - - <div class="fl pad1y space-right2"> - <span class="strong">78.94% </span> - <span class="quiet">Lines</span> - <span class="fraction">15/19</span> - </div> + <div class='clearfix'> + + <div class='fl pad1y space-right2'> + <span class="strong">72.72% </span> + <span class="quiet">Statements</span> + <span class='fraction'>16/22</span> + </div> + + + <div class='fl pad1y space-right2'> + <span class="strong">62.5% </span> + <span class="quiet">Branches</span> + <span class='fraction'>10/16</span> + </div> + + + <div class='fl pad1y space-right2'> + <span class="strong">62.5% </span> + <span class="quiet">Functions</span> + <span class='fraction'>5/8</span> + </div> + + + <div class='fl pad1y space-right2'> + <span class="strong">72.72% </span> + <span class="quiet">Lines</span> + <span class='fraction'>16/22</span> + </div> + + </div> <p class="quiet"> - Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, - <em>p</em> or <em>k</em> for the previous block. + Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block. </p> <template id="filterTemplate"> - <div class="quiet"> - Filter: - <input type="search" id="fileSearch" /> - </div> + <div class="quiet"> + Filter: + <input type="search" id="fileSearch"> + </div> </template> - </div> - <div class="status-line medium"></div> - <pre><table class="coverage"> + </div> + <div class='status-line medium'></div> + <pre><table class="coverage"> <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a> <a name='L2'></a><a href='#L2'>2</a> <a name='L3'></a><a href='#L3'>3</a> @@ -146,7 +153,17 @@ <a name='L88'></a><a href='#L88'>88</a> <a name='L89'></a><a href='#L89'>89</a> <a name='L90'></a><a href='#L90'>90</a> -<a name='L91'></a><a href='#L91'>91</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span> +<a name='L91'></a><a href='#L91'>91</a> +<a name='L92'></a><a href='#L92'>92</a> +<a name='L93'></a><a href='#L93'>93</a> +<a name='L94'></a><a href='#L94'>94</a> +<a name='L95'></a><a href='#L95'>95</a> +<a name='L96'></a><a href='#L96'>96</a> +<a name='L97'></a><a href='#L97'>97</a> +<a name='L98'></a><a href='#L98'>98</a> +<a name='L99'></a><a href='#L99'>99</a> +<a name='L100'></a><a href='#L100'>100</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span> +<span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> @@ -185,16 +202,18 @@ <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-yes">1x</span> +<span class="cline-any cline-neutral"> </span> <span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> +<span class="cline-any cline-neutral"> </span> +<span class="cline-any cline-neutral"> </span> +<span class="cline-any cline-neutral"> </span> <span class="cline-any cline-no"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> -<span class="cline-any cline-yes">1x</span> -<span class="cline-any cline-yes">1x</span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> @@ -215,8 +234,14 @@ <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> +<span class="cline-any cline-yes">2x</span> +<span class="cline-any cline-neutral"> </span> +<span class="cline-any cline-yes">2x</span> +<span class="cline-any cline-no"> </span> +<span class="cline-any cline-no"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> +<span class="cline-any cline-yes">2x</span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-yes">2x</span> <span class="cline-any cline-neutral"> </span> @@ -237,9 +262,10 @@ <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span> <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useEffect, useState } from 'react'; -import { BrowserRouter, Routes, Route, Navigate, useLocation, useNavigate } from 'react-router-dom'; +import { BrowserRouter, Routes, Route, Navigate, useLocation } from 'react-router-dom'; import Login from './components/Login'; import './App.css'; +import { apiFetch } from './utils'; // Protected Route wrapper function RequireAuth({ children }: { children: React.ReactElement }) { @@ -247,7 +273,7 @@ function RequireAuth({ children }: { children: React.ReactElement }) { const location = useLocation(); useEffect(() => { - fetch('/api/auth') + apiFetch('/api/auth') .then((res) => { if (res.ok) { setAuth(true); @@ -273,26 +299,25 @@ import FeedList from './components/FeedList'; import FeedItems from './components/FeedItems'; import Settings from './components/Settings'; -function Dashboard() { - const navigate = useNavigate(); - return ( - <div className="dashboard"> - <header className="dashboard-header"> - <h1>Neko Reader</h1> - <nav> - <button onClick={<span class="fstat-no" title="function not covered" >() => <span class="cstat-no" title="statement not covered" >n</span>avigate('/settings')} c</span>lassName="nav-link" style={{ color: 'white', marginRight: '1rem', background: 'none', border: 'none', cursor: 'pointer', fontSize: 'inherit', fontFamily: 'inherit' }}>Settings</button> +function Dashboard({ theme, setTheme }: { theme: string; setTheme: (t: string) => void }) { + const [sidebarVisible, setSidebarVisible] = useState(true); - <button onClick={() => { - fetch('/api/logout', { method: 'POST' }) - .then(() => window.location.href = '/v2/login'); - }} className="logout-btn"> - Logout - </button> - </nav> - </header> + return ( + <div + className={`dashboard ${sidebarVisible ? 'sidebar-visible' : <span class="branch-1 cbranch-no" title="branch not covered" >'sidebar-hidden'}</span> theme-${theme}`} + > <div className="dashboard-content"> - <aside className="dashboard-sidebar"> - <FeedList /> + {!sidebarVisible && ( +<span class="branch-1 cbranch-no" title="branch not covered" > <button</span> + className="sidebar-toggle fixed-toggle" + onClick={<span class="fstat-no" title="function not covered" >() => <span class="cstat-no" title="statement not covered" >s</span>etSidebarVisible(true)}</span> + title="Show Sidebar" + > + 🐱 + </button> + )} + <aside className={`dashboard-sidebar ${sidebarVisible ? '' : <span class="branch-1 cbranch-no" title="branch not covered" >'hidden'}</span>`}> + <FeedList theme={theme} setTheme={setTheme} setSidebarVisible={setSidebarVisible} /> </aside> <main className="dashboard-main"> <Routes> @@ -308,15 +333,24 @@ function Dashboard() { } function App() { + const [theme, setTheme] = useState(localStorage.getItem('neko-theme') || 'light'); + + const handleSetTheme = <span class="fstat-no" title="function not covered" >(n</span>ewTheme: string) => { +<span class="cstat-no" title="statement not covered" > setTheme(newTheme);</span> +<span class="cstat-no" title="statement not covered" > localStorage.setItem('neko-theme', newTheme);</span> + }; + + const basename = window.location.pathname.startsWith('/v2') ? '/v2' : <span class="branch-1 cbranch-no" title="branch not covered" >'/';</span> + return ( - <BrowserRouter basename="/v2"> + <BrowserRouter basename={basename}> <Routes> <Route path="/login" element={<Login />} /> <Route path="/*" element={ <RequireAuth> - <Dashboard /> + <Dashboard theme={theme} setTheme={handleSetTheme} /> </RequireAuth> } /> @@ -328,22 +362,21 @@ function App() { export default App; </pre></td></tr></table></pre> - <div class="push"></div> - <!-- for sticky footer --> - </div> - <!-- /wrapper --> - <div class="footer quiet pad2 space-top1 center small"> - Code coverage generated by - <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> - at 2026-02-13T21:49:58.924Z - </div> - <script src="../prettify.js"></script> - <script> - window.onload = function () { - prettyPrint(); - }; - </script> - <script src="../sorter.js"></script> - <script src="../block-navigation.js"></script> - </body> + <div class='push'></div><!-- for sticky footer --> + </div><!-- /wrapper --> + <div class='footer quiet pad2 space-top1 center small'> + Code coverage generated by + <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a> + at 2026-02-14T18:02:09.004Z + </div> + <script src="../prettify.js"></script> + <script> + window.onload = function () { + prettyPrint(); + }; + </script> + <script src="../sorter.js"></script> + <script src="../block-navigation.js"></script> + </body> </html> +
\ No newline at end of file |
