From dac83dd0011e7b46bafa8f7140f15fd58187769a Mon Sep 17 00:00:00 2001 From: Alba Rivas Date: Tue, 30 Jan 2024 13:55:45 +0100 Subject: [PATCH] Add stylesheets recipe (#896) * Add stylesheets recipe * Add tab to app * Fix deploy * Fix deploy --- .../applications/LWC_Recipes.app-meta.xml | 1 + .../LWC_Recipes_Console_App.app-meta.xml | 73 ------------------- .../Misc_Techniques.flexipage-meta.xml | 6 -- .../flexipages/Styling.flexipage-meta.xml | 36 +++++++++ .../lwc/miscStylingHooks/miscStylingHooks.js | 3 - .../stylesheets/__tests__/stylesheets.test.js | 21 ++++++ .../default/lwc/stylesheets/stylesheets.css | 3 + .../default/lwc/stylesheets/stylesheets.html | 10 +++ .../default/lwc/stylesheets/stylesheets.js | 6 ++ .../stylesheets.js-meta.xml} | 0 .../default/lwc/stylesheets/text-styles.css | 7 ++ .../__tests__/stylingHooks.test.js | 21 ++++++ .../stylingHooks.css} | 0 .../stylingHooks.html} | 4 +- .../default/lwc/stylingHooks/stylingHooks.js | 3 + .../lwc/stylingHooks/stylingHooks.js-meta.xml | 10 +++ .../recipes.permissionset-meta.xml | 4 + .../main/default/tabs/Styling.tab-meta.xml | 7 ++ 18 files changed, 131 insertions(+), 84 deletions(-) create mode 100644 force-app/main/default/flexipages/Styling.flexipage-meta.xml delete mode 100644 force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.js create mode 100644 force-app/main/default/lwc/stylesheets/__tests__/stylesheets.test.js create mode 100644 force-app/main/default/lwc/stylesheets/stylesheets.css create mode 100644 force-app/main/default/lwc/stylesheets/stylesheets.html create mode 100644 force-app/main/default/lwc/stylesheets/stylesheets.js rename force-app/main/default/lwc/{miscStylingHooks/miscStylingHooks.js-meta.xml => stylesheets/stylesheets.js-meta.xml} (100%) create mode 100644 force-app/main/default/lwc/stylesheets/text-styles.css create mode 100644 force-app/main/default/lwc/stylingHooks/__tests__/stylingHooks.test.js rename force-app/main/default/lwc/{miscStylingHooks/miscStylingHooks.css => stylingHooks/stylingHooks.css} (100%) rename force-app/main/default/lwc/{miscStylingHooks/miscStylingHooks.html => stylingHooks/stylingHooks.html} (87%) create mode 100644 force-app/main/default/lwc/stylingHooks/stylingHooks.js create mode 100644 force-app/main/default/lwc/stylingHooks/stylingHooks.js-meta.xml create mode 100644 force-app/main/default/tabs/Styling.tab-meta.xml diff --git a/force-app/main/default/applications/LWC_Recipes.app-meta.xml b/force-app/main/default/applications/LWC_Recipes.app-meta.xml index 36d423bf6..21fa80198 100644 --- a/force-app/main/default/applications/LWC_Recipes.app-meta.xml +++ b/force-app/main/default/applications/LWC_Recipes.app-meta.xml @@ -43,6 +43,7 @@ Record_Picker Misc_Techniques X3rd_Party_Libs + Styling Lightning LWC_Recipes_UtilityBar diff --git a/force-app/main/default/applications/LWC_Recipes_Console_App.app-meta.xml b/force-app/main/default/applications/LWC_Recipes_Console_App.app-meta.xml index 1e065a263..896f97405 100644 --- a/force-app/main/default/applications/LWC_Recipes_Console_App.app-meta.xml +++ b/force-app/main/default/applications/LWC_Recipes_Console_App.app-meta.xml @@ -11,85 +11,12 @@ false Console - Hello - Datatable - Apex - standard-Contact - Composition - Events - Parent_to_Child - Message_Service - Refresh_View - Light_DOM - Dynamic_Interactions - Aura_Interoperability - Wire - GraphQL - Navigation - Record_Picker - Misc_Techniques - X3rd_Party_Libs Workspace_API_Tab_Launcher Lightning LWC_Recipes_Console_App_UtilityBar - - Apex - - - Aura_Interoperability - - - Composition - - - Datatable - - - Dynamic_Interactions - - - Events - - - GraphQL - - - Hello - - - Light_DOM - - - Message_Service - - - Misc_Techniques - - - Navigation - - - Parent_to_Child - - - Record_Picker - - - Refresh_View - - - Wire - Workspace_API_Tab_Launcher - - X3rd_Party_Libs - - - AccountId - standard-Contact - diff --git a/force-app/main/default/flexipages/Misc_Techniques.flexipage-meta.xml b/force-app/main/default/flexipages/Misc_Techniques.flexipage-meta.xml index 6f1ced636..57662e09f 100644 --- a/force-app/main/default/flexipages/Misc_Techniques.flexipage-meta.xml +++ b/force-app/main/default/flexipages/Misc_Techniques.flexipage-meta.xml @@ -61,12 +61,6 @@ Region - - - miscStylingHooks - c_miscStylingHooks1 - - miscStaticResource diff --git a/force-app/main/default/flexipages/Styling.flexipage-meta.xml b/force-app/main/default/flexipages/Styling.flexipage-meta.xml new file mode 100644 index 000000000..9da51882b --- /dev/null +++ b/force-app/main/default/flexipages/Styling.flexipage-meta.xml @@ -0,0 +1,36 @@ + + + + region1 + Region + + + + + stylesheets + c_stylesheets + + + region2 + Region + + + + + stylingHooks + c_stylingHooks + + + region3 + Region + + + region4 + Region + + Styling + + AppPage + diff --git a/force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.js b/force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.js deleted file mode 100644 index 731fcea77..000000000 --- a/force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.js +++ /dev/null @@ -1,3 +0,0 @@ -import { LightningElement } from 'lwc'; - -export default class MiscStylingHooks extends LightningElement {} diff --git a/force-app/main/default/lwc/stylesheets/__tests__/stylesheets.test.js b/force-app/main/default/lwc/stylesheets/__tests__/stylesheets.test.js new file mode 100644 index 000000000..8e08443d7 --- /dev/null +++ b/force-app/main/default/lwc/stylesheets/__tests__/stylesheets.test.js @@ -0,0 +1,21 @@ +import { createElement } from 'lwc'; +import Stylesheets from 'c/stylesheets'; + +describe('c-misc-stylesheets', () => { + afterEach(() => { + // The jsdom instance is shared across test cases in a single file so reset the DOM + while (document.body.firstChild) { + document.body.removeChild(document.body.firstChild); + } + }); + + it('is accessible', async () => { + const element = createElement('c-stylesheets', { + is: Stylesheets + }); + document.body.appendChild(element); + + // Check accessibility + await expect(element).toBeAccessible(); + }); +}); diff --git a/force-app/main/default/lwc/stylesheets/stylesheets.css b/force-app/main/default/lwc/stylesheets/stylesheets.css new file mode 100644 index 000000000..265ffcaf4 --- /dev/null +++ b/force-app/main/default/lwc/stylesheets/stylesheets.css @@ -0,0 +1,3 @@ +.card-body { + background-color: yellow; +} diff --git a/force-app/main/default/lwc/stylesheets/stylesheets.html b/force-app/main/default/lwc/stylesheets/stylesheets.html new file mode 100644 index 000000000..f538facbf --- /dev/null +++ b/force-app/main/default/lwc/stylesheets/stylesheets.html @@ -0,0 +1,10 @@ + diff --git a/force-app/main/default/lwc/stylesheets/stylesheets.js b/force-app/main/default/lwc/stylesheets/stylesheets.js new file mode 100644 index 000000000..a218f3a57 --- /dev/null +++ b/force-app/main/default/lwc/stylesheets/stylesheets.js @@ -0,0 +1,6 @@ +import { LightningElement } from 'lwc'; +import textStyles from './text-styles.css'; + +export default class Stylesheets extends LightningElement { + static stylesheets = [textStyles]; +} diff --git a/force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.js-meta.xml b/force-app/main/default/lwc/stylesheets/stylesheets.js-meta.xml similarity index 100% rename from force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.js-meta.xml rename to force-app/main/default/lwc/stylesheets/stylesheets.js-meta.xml diff --git a/force-app/main/default/lwc/stylesheets/text-styles.css b/force-app/main/default/lwc/stylesheets/text-styles.css new file mode 100644 index 000000000..2cba565cb --- /dev/null +++ b/force-app/main/default/lwc/stylesheets/text-styles.css @@ -0,0 +1,7 @@ +.fancy-text { + color: #d54d7b; + font-family: 'Great Vibes', cursive; + font-weight: normal; + text-align: center; + text-shadow: 0 1px 1px #fff; +} diff --git a/force-app/main/default/lwc/stylingHooks/__tests__/stylingHooks.test.js b/force-app/main/default/lwc/stylingHooks/__tests__/stylingHooks.test.js new file mode 100644 index 000000000..cbe539f26 --- /dev/null +++ b/force-app/main/default/lwc/stylingHooks/__tests__/stylingHooks.test.js @@ -0,0 +1,21 @@ +import { createElement } from 'lwc'; +import StylingHooks from 'c/stylingHooks'; + +describe('c-misc-stylesheets', () => { + afterEach(() => { + // The jsdom instance is shared across test cases in a single file so reset the DOM + while (document.body.firstChild) { + document.body.removeChild(document.body.firstChild); + } + }); + + it('is accessible', async () => { + const element = createElement('c-styling-hooks', { + is: StylingHooks + }); + document.body.appendChild(element); + + // Check accessibility + await expect(element).toBeAccessible(); + }); +}); diff --git a/force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.css b/force-app/main/default/lwc/stylingHooks/stylingHooks.css similarity index 100% rename from force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.css rename to force-app/main/default/lwc/stylingHooks/stylingHooks.css diff --git a/force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.html b/force-app/main/default/lwc/stylingHooks/stylingHooks.html similarity index 87% rename from force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.html rename to force-app/main/default/lwc/stylingHooks/stylingHooks.html index d697d2233..e34738b26 100644 --- a/force-app/main/default/lwc/miscStylingHooks/miscStylingHooks.html +++ b/force-app/main/default/lwc/stylingHooks/stylingHooks.html @@ -1,5 +1,5 @@