π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
π§ͺ Tests for icon color
Alicia Sykescc6afb04f1f2
diff --git a/tests/components/item.test.js b/tests/components/item.test.jsindex c966e3de..f3da1ee0 100644--- a/tests/components/item.test.js+++ b/tests/components/item.test.js@@ -928,4 +928,32 @@ describe('Template rendering', () => {const { wrapper } = mountItem();expect(wrapper.find('a.item').attributes('id')).toBe('link-test-1');});++ it('applies iconColor to the icon only', () => {+ const { wrapper } = mountItem({+ item: {+ id: '1', title: 'X', url: '#', icon: 'si-github', color: 'red', iconColor: 'blue',+ },+ });+ expect(wrapper.find('a.item').attributes('style')).toContain('color: red');+ expect(wrapper.findComponent({ name: 'Icon' }).attributes('style')).toContain('color: blue');+ });++ it('falls back to color for the icon', () => {+ const { wrapper } = mountItem({+ item: {+ id: '1', title: 'X', url: '#', icon: 'si-github', color: 'red',+ },+ });+ expect(wrapper.findComponent({ name: 'Icon' }).attributes('style')).toContain('color: red');+ });++ it('updates the icon color when the item is edited', async () => {+ const item = {+ id: '1', title: 'X', url: '#', icon: 'si-github',+ };+ const { wrapper } = mountItem({ item });+ await wrapper.setProps({ item: { ...item, iconColor: 'blue' } });+ expect(wrapper.findComponent({ name: 'Icon' }).attributes('style')).toContain('color: blue');+ });});diff --git a/tests/components/sidebar-item.test.js b/tests/components/sidebar-item.test.jsindex 48b095fd..0de2ecf5 100644--- a/tests/components/sidebar-item.test.js+++ b/tests/components/sidebar-item.test.js@@ -76,4 +76,9 @@ describe('SideBarItem', () => {const wrapper = mountItem({ title: 'App', url: 'https://example.com' }, { active: true });expect(wrapper.classes()).toContain('active');});++ it('applies iconColor to the icon', () => {+ const wrapper = mountItem({ icon: 'si-github', url: 'https://example.com', iconColor: 'blue' });+ expect(wrapper.findComponent({ name: 'Icon' }).attributes('style')).toContain('color: blue');+ });});diff --git a/tests/components/workspace.test.js b/tests/components/workspace.test.jsindex ba865de7..bc474332 100644--- a/tests/components/workspace.test.js+++ b/tests/components/workspace.test.js@@ -17,7 +17,7 @@ const sections = [{name: 'Apps',items: [- { title: 'One', url: 'https://one.com/' },+ { title: 'One', url: 'https://one.com/', icon: 'si-github', iconColor: 'blue' },{ title: 'Hidden', url: 'https://hidden.com/', displayData: { hideFromWorkspace: true } },],},@@ -161,4 +161,9 @@ describe('Workspace SideBar', () => {await wrapper.findAll('.close-app')[1].trigger('click');expect(wrapper.emitted('close-app')).toEqual([['https://other.com/']]);});++ it('keeps the item icon color for open apps', () => {+ const wrapper = mountSideBar({ openUrls: ['https://one.com/'] });+ expect(wrapper.find('.open-apps').findComponent({ name: 'Icon' }).attributes('style')).toContain('color: blue');+ });});