diff options
| -rw-r--r-- | scripts/theme-studio/browser-gates.js | 9 | ||||
| -rw-r--r-- | scripts/theme-studio/theme-studio.html | 9 | ||||
| -rw-r--r-- | tests/test-nerd-icons-config--color-dir.el | 15 |
3 files changed, 33 insertions, 0 deletions
diff --git a/scripts/theme-studio/browser-gates.js b/scripts/theme-studio/browser-gates.js index e428ae58c..a4412d0b5 100644 --- a/scripts/theme-studio/browser-gates.js +++ b/scripts/theme-studio/browser-gates.js @@ -835,6 +835,15 @@ if(location.hash==='#nerdiconstest')gate('nerdiconstest',A=>{ A(els.length===mapped.length,'every '+target+' row rendered ('+els.length+'/'+mapped.length+')'); A(els.length>0&&els.every(e=>/#abcdef/i.test(e.getAttribute('style')||'')),'recolor repaints the mapped rows'); }); + // Export/import round-trip over an assigned nerd-icons color; the separate + // nerd-icons-completion app (dir-face) is untouched by the nerd-icons pane. + const m=seedPkgmap(); + m['nerd-icons']['nerd-icons-blue']={fg:'#123456',bg:null,weight:null,slant:null,inherit:null,height:1,source:'user'}; + const exp=packagesForExport(m); + A(exp['nerd-icons']&&exp['nerd-icons']['nerd-icons-blue']&&exp['nerd-icons']['nerd-icons-blue'].fg==='#123456','assigned nerd-icons color exports'); + const round=seedPkgmap();mergePackagesInto(round,exp); + A(round['nerd-icons']&&round['nerd-icons']['nerd-icons-blue'].fg==='#123456','nerd-icons color re-imports to the same state'); + A(!(exp['nerd-icons']&&('nerd-icons-completion-dir-face' in exp['nerd-icons'])),'dir-face stays out of the nerd-icons app'); } }); // picker-distinct gate (open with #pickertest): the color picker panel must stand diff --git a/scripts/theme-studio/theme-studio.html b/scripts/theme-studio/theme-studio.html index 8724ef559..556f61e60 100644 --- a/scripts/theme-studio/theme-studio.html +++ b/scripts/theme-studio/theme-studio.html @@ -4120,6 +4120,15 @@ if(location.hash==='#nerdiconstest')gate('nerdiconstest',A=>{ A(els.length===mapped.length,'every '+target+' row rendered ('+els.length+'/'+mapped.length+')'); A(els.length>0&&els.every(e=>/#abcdef/i.test(e.getAttribute('style')||'')),'recolor repaints the mapped rows'); }); + // Export/import round-trip over an assigned nerd-icons color; the separate + // nerd-icons-completion app (dir-face) is untouched by the nerd-icons pane. + const m=seedPkgmap(); + m['nerd-icons']['nerd-icons-blue']={fg:'#123456',bg:null,weight:null,slant:null,inherit:null,height:1,source:'user'}; + const exp=packagesForExport(m); + A(exp['nerd-icons']&&exp['nerd-icons']['nerd-icons-blue']&&exp['nerd-icons']['nerd-icons-blue'].fg==='#123456','assigned nerd-icons color exports'); + const round=seedPkgmap();mergePackagesInto(round,exp); + A(round['nerd-icons']&&round['nerd-icons']['nerd-icons-blue'].fg==='#123456','nerd-icons color re-imports to the same state'); + A(!(exp['nerd-icons']&&('nerd-icons-completion-dir-face' in exp['nerd-icons'])),'dir-face stays out of the nerd-icons app'); } }); // picker-distinct gate (open with #pickertest): the color picker panel must stand diff --git a/tests/test-nerd-icons-config--color-dir.el b/tests/test-nerd-icons-config--color-dir.el index 808c0dc34..2ae64a810 100644 --- a/tests/test-nerd-icons-config--color-dir.el +++ b/tests/test-nerd-icons-config--color-dir.el @@ -53,5 +53,20 @@ renders would stack `nerd-icons-yellow' over and over on the cached string." (yellows (cl-count 'nerd-icons-yellow specs))) (should (= yellows 1))))) +(ert-deftest test-nerd-icons-config--color-dir-precedence-over-completion-face () + "Normal: when the dir icon already carries nerd-icons-completion-dir-face +\(what `nerd-icons-completion-get-icon' passes), the advice prepends +nerd-icons-yellow so it is first in the face list and wins the merge. Locks +the dir-precedence decision: the prepended advice face outranks the package's +:face, even though that face lives in a different package." + (let* ((icon (propertize "X" 'face 'nerd-icons-completion-dir-face)) + (result (cj/--nerd-icons-color-dir icon)) + (faces (ensure-list (get-text-property 0 'face result)))) + (should (memq 'nerd-icons-yellow faces)) + (should (memq 'nerd-icons-completion-dir-face faces)) + (should (= 0 (cl-position 'nerd-icons-yellow faces))) + (should (< (cl-position 'nerd-icons-yellow faces) + (cl-position 'nerd-icons-completion-dir-face faces))))) + (provide 'test-nerd-icons-config--color-dir) ;;; test-nerd-icons-config--color-dir.el ends here |
