mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
The new runner ran all 260 suites for the first time: 20 failed. Four were real
defects in the app, the rest were guards pinning a spelling or a design that had
since changed - each of them written when it was true, and none of them run
since, because npm stopped the chain at the first failure.
The app fixes:
* models/lib/themeAccents.js: accentOf('constructor') returned Object's
constructor - a FUNCTION - because a plain lookup answers from
Object.prototype. A board colour named after any prototype member would have
written a function into a stylesheet. Only the map's own keys are themes now.
* RTL: the dependency overlay and its connect handle each set a physical
left/right AFTER the logical property, so the physical one won and both were
pinned to the LTR side in an Arabic or Hebrew layout. The skip link, the
avatar's account badge, the stats value column and the theme-category label
were physical too. All logical now (inset-inline-*, text-align: start/end).
The guards, each corrected to what the code actually does now, with the reason:
* addBoardTileHeight, publicationArgumentGuard: a fixed-size slice
(jade + 3000, source + 1400) that a grown comment pushed the subject out of.
Both now take the whole block they are about.
* adminCheckboxStyle: the Grey Icons feature is gone; asserts its REMOVAL.
* boardsVisibilitySettings: the separator count was pinned at 3; the site-theme
picker group made it 4. Asserts the shape - one Save per section, none for
the picker that applies immediately.
* changelogFormat: "# Upcoming WeKan ® release" is a legitimate heading.
* dbConformanceWiring: the log directory honours WEKAN_LOGDIR now.
* domainTablePage: the default page is the app-wide 10, not 25.
* ferretdbOplogGating: the exec runs under the CPU launcher.
* leftMenu: peopleMenu takes the user (multitenancy option D).
* loginEmailPanesMoved: the board-member restriction is two checkboxes in
Organizations and Teams now; asserted there.
* mobileAllBoardsFit: the bell and the avatar are two rules with variants.
* narrowWindowLayout: the hamburger is the last button in the flow, not pinned.
* rulesApiTriggerNormalize: #6491 made a missing matching field mean "any
value", so the #2674 "can never match" case now matches - and removeMember
iterates assignees, not members.
* securityLog: the new-problems selector moved to models/lib/eventLogProblems.
* tablePage: the Cards report renders the page the SERVER named.
* tenantWiring: the site colour is read in two places; the autorun is the one.
* themeAccents: see above - the guard was right, the code was not.
* translationPane: the "no hand-written table" regex matched the +tablePage
include it also requires.
* uiDensity: admin table cells wrap in one td+th rule now.
* rtl: the dir attribute comes from a helper, `!important` is not part of a
value, and the scanner read CSS COMMENTS as declarations - the comment
explaining why `left: 50%` needs no RTL variant was reported as a violation.
Thanks to xet7 !
65 lines
2.7 KiB
JavaScript
65 lines
2.7 KiB
JavaScript
// The accent colour of every named theme — the colour that theme paints its header
|
|
// bar with (docs/Design/Page/Theme.md).
|
|
//
|
|
// WeKan's chrome outside a board reads ONE CSS variable, `--theme-accent`: the
|
|
// Admin Panel's selected left-menu row, its buttons, every Save button, the table
|
|
// page's controls. Until now that variable was only set when a user picked a CUSTOM
|
|
// colour for a flat/clear theme, so choosing a named theme like Pumpkin recoloured
|
|
// the header (which has its own `.board-color-pumpkin#header` rule) and left the
|
|
// menu row and the buttons on the stock blue fallback.
|
|
//
|
|
// This map closes that gap: whatever theme is active - the user's own override, a
|
|
// board's colour, or the site theme - its accent is published as `--theme-accent`,
|
|
// and everything that already reads the variable follows along.
|
|
//
|
|
// The values MIRROR client/components/boards/boardColors.css: each is the
|
|
// `background-color` of that theme's `#header` rule. tests/themeAccents.test.cjs
|
|
// parses that stylesheet and fails if the two ever disagree, so a new theme cannot
|
|
// be added in CSS alone and quietly fall back to blue.
|
|
const THEME_ACCENTS = {
|
|
belize: '#2980b9',
|
|
nephritis: '#27ae60',
|
|
pomegranate: '#c0392b',
|
|
pumpkin: '#e67e22',
|
|
wisteria: '#8e44ad',
|
|
moderatepink: '#cd5a91',
|
|
strongcyan: '#00aecc',
|
|
limegreen: '#4bbf6b',
|
|
midnight: '#2c3e50',
|
|
dark: '#2c3e51',
|
|
relax: '#27ae61',
|
|
corteza: '#568ba2',
|
|
clearblue: '#2d8ce7',
|
|
natural: '#596557',
|
|
modern: '#2a80b8',
|
|
moderndark: '#2a2a2a',
|
|
exodark: '#222',
|
|
cleandark: '#2E2E39',
|
|
cleanlight: 'rgba(190, 190, 190, 1)',
|
|
};
|
|
|
|
// The accent of one theme, or '' when the name is unknown (which is what an
|
|
// unthemed instance and a bad value both look like).
|
|
function accentOf(color) {
|
|
// hasOwnProperty, not a plain lookup: `THEME_ACCENTS['constructor']` answers
|
|
// with Object's constructor, and 'toString' with a function - so a board whose
|
|
// colour is named after any Object.prototype member would have got a FUNCTION
|
|
// as its accent and written it into a stylesheet. Only the map's own keys are
|
|
// themes.
|
|
if (typeof color !== 'string') return '';
|
|
return Object.prototype.hasOwnProperty.call(THEME_ACCENTS, color)
|
|
? THEME_ACCENTS[color] || ''
|
|
: '';
|
|
}
|
|
|
|
// The accent to publish as `--theme-accent`, given the active theme and whatever
|
|
// custom colours go with it. A custom colour ALWAYS wins: it is the one the user
|
|
// chose on top of the theme.
|
|
function activeAccent(color, customColors) {
|
|
const custom = Array.isArray(customColors) ? customColors : [];
|
|
if (typeof custom[0] === 'string' && custom[0]) return custom[0];
|
|
return accentOf(color);
|
|
}
|
|
|
|
export { THEME_ACCENTS, accentOf, activeAccent };
|