-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
215 changed files
with
13,919 additions
and
24,388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Conventions | ||
|
||
Beyond Boilerplate's own [documented file structure conventions](https://imarc-boilerplate.netlify.app/pattern-library/docs/structure.html), here are some internal conventions that make sense to follow when contributing to Boilerplate itself. These are just meant to make sure that Boilerplate itself has consistent patterns and terminology. | ||
|
||
## Files | ||
|
||
In general, avoid huge files in favor of breaking up files into smaller pieces. If a single component gets too complicated, consider breaking it up or creating separate files for its modifiers. | ||
|
||
|
||
## Code | ||
|
||
### Lint Your Code | ||
|
||
Make sure to lint your code before pull requests. You can do this by running `npm run lint` or through your editor if your editor has eslint integration. | ||
|
||
### CSS/Sass | ||
|
||
#### Avoid `@import`, use `@use`/`@forwards` | ||
|
||
Unless necessary, avoid the Sass `@import` statement. Using the CSS native `@import` (for things like web fonts) is fine. | ||
|
||
#### Only use common as * | ||
|
||
Only use /resources/styles/common without a namespace. As in, only | ||
``` | ||
@use "/resource/styles/common" as *; | ||
``` | ||
All other use statements should put them in their own namespaces. | ||
|
||
#### Prefer Sass Variables | ||
|
||
Prefer Sass variables over custom properties. In general, only use custom properties if | ||
|
||
1. If the value will change based on media queries. | ||
2. You're going to change the value and use the value more than once. | ||
3. You're going to change the value and the value is only part of a property. For example, a stop within a gradient. | ||
|
||
Prefer to keep canonical values in Sass. Sass is more powerful than CSS still. You can use Sass variables in CSS expressions, but you can't use custom properties in Sass expressions. | ||
|
||
##### Custom Property Naming | ||
|
||
Use [BPM](https://www.imarc.com/blog/block-property-modifier-a-bem-like-css-custom-properties-methodology) for general naming. There are some project specific conventions as well: | ||
|
||
* In general, `--color` and `--<componentName>-color` will be used to set a component's dominant color instead of text color. | ||
* A suffix of `-contrast` (for example, `--color-contrast`) indicates that it's a near black or near white color meant to provide sufficient contrast for text when used on top of the related color. | ||
* A suffix of `-faded` is used for repeating an existing color with a lower opacity. | ||
|
||
|
||
#### Prefer Triple slashes for docblock comments | ||
|
||
|
||
### Vue | ||
|
||
#### Use The Composition API | ||
|
||
All components should be built to use the Vue composition API. We should aim to clearly separate composable components for functionality that are used by simple, UI focused components. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"baseUrl": "http://localhost:5173", | ||
"testFiles": "**/*.spec.js", | ||
"componentFolder": "resources/" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
describe('BpClickable', () => { | ||
beforeEach(() => cy.visit('/components/preview/clickable')) | ||
|
||
it('is clickable', () => { | ||
cy.get('.card').first().click() | ||
cy.location('hash').should('eq', '#example') | ||
}) | ||
|
||
it('works with multiple instances', () => { | ||
cy.get('.card').eq(1).click() | ||
cy.location('hash').should('eq', '#example2') | ||
}) | ||
|
||
it('allows nested links to work', () => { | ||
cy.get('.card .card__content a').first().click() | ||
cy.location('hash').should('eq', '#nope') | ||
}) | ||
|
||
it('clicking the CTA still works', () => { | ||
cy.get('.card .card__action').first().click() | ||
cy.location('hash').should('eq', '#example') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
describe('BpDirectional at 1000px wide', () => { | ||
beforeEach(() => cy.visit('/components/preview/directional')) | ||
it('can be focused', () => { | ||
cy.get('li a').first().focus() | ||
cy.get('li a').first().should('be.focused') | ||
}) | ||
|
||
it('moves focus right', () => { | ||
cy.get('li a').first().focus() | ||
cy.get('li a').first().should('be.focused') | ||
cy.get('body').type('{rightArrow}') | ||
cy.get('li a').eq(1).should('be.focused') | ||
cy.get('body').type('{rightArrow}') | ||
cy.get('li a').eq(2).should('be.focused') | ||
}) | ||
|
||
it('moves focus left', () => { | ||
cy.get('li a').eq(2).focus() | ||
cy.get('body').type('{leftArrow}') | ||
cy.get('li a').eq(1).should('be.focused') | ||
cy.get('body').type('{leftArrow}') | ||
cy.get('li a').eq(0).should('be.focused') | ||
}) | ||
|
||
it('moves focus down', () => { | ||
cy.get('li a').first().focus() | ||
cy.get('body').type('{downArrow}') | ||
cy.get('li a').eq(3).should('be.focused') | ||
cy.get('body').type('{downArrow}') | ||
cy.get('li a').eq(6).should('be.focused') | ||
}) | ||
|
||
it('moves focus up', () => { | ||
cy.get('li a').eq(7).focus() | ||
cy.get('body').type('{upArrow}') | ||
cy.get('li a').eq(4).should('be.focused') | ||
cy.get('body').type('{upArrow}') | ||
cy.get('li a').eq(1).should('be.focused') | ||
}) | ||
|
||
it('moves focus via home', () => { | ||
cy.get('li a').eq(7).focus() | ||
cy.get('body').type('{home}') | ||
cy.get('li a').eq(0).should('be.focused') | ||
}) | ||
|
||
it('moves focus via end', () => { | ||
cy.get('li a').eq(7).focus() | ||
cy.get('body').type('{end}') | ||
cy.get('li a').last().should('be.focused') | ||
}) | ||
|
||
it('contrains bounds', () => { | ||
cy.get('li a').first().focus() | ||
cy.get('body').type('{upArrow}') | ||
cy.get('li a').first().should('be.focused') | ||
cy.get('body').type('{leftArrow}') | ||
cy.get('li a').first().should('be.focused') | ||
|
||
cy.get('li a').last().focus() | ||
cy.get('body').type('{downArrow}') | ||
cy.get('li a').last().should('be.focused') | ||
cy.get('body').type('{rightArrow}') | ||
cy.get('li a').last().should('be.focused') | ||
}) | ||
}) | ||
|
||
describe('BpDirectional at 700px wide', () => { | ||
beforeEach(() => { | ||
cy.viewport(700, 660) | ||
cy.visit('/components/preview/directional') | ||
}) | ||
|
||
it('moves focus right', () => { | ||
cy.get('li a').first().focus() | ||
cy.get('li a').first().should('be.focused') | ||
cy.get('body').type('{rightArrow}') | ||
cy.get('li a').eq(1).should('be.focused') | ||
}) | ||
|
||
it('moves focus left', () => { | ||
cy.get('li a').eq(1).focus() | ||
cy.get('body').type('{leftArrow}') | ||
cy.get('li a').eq(0).should('be.focused') | ||
}) | ||
|
||
it('moves focus down', () => { | ||
cy.get('li a').first().focus() | ||
cy.get('body').type('{downArrow}') | ||
cy.get('li a').eq(2).should('be.focused') | ||
cy.get('body').type('{downArrow}') | ||
cy.get('li a').eq(4).should('be.focused') | ||
}) | ||
|
||
it('moves focus up', () => { | ||
cy.get('li a').eq(5).focus() | ||
cy.get('body').type('{upArrow}') | ||
cy.get('li a').eq(3).should('be.focused') | ||
cy.get('body').type('{upArrow}') | ||
cy.get('li a').eq(1).should('be.focused') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe('BpDismissable', () => { | ||
it('visible on load', () => { | ||
cy.visit('/components/preview/dismissable') | ||
cy.get('.banner').should('be.visible') | ||
}) | ||
|
||
it('can be dismissed', () => { | ||
cy.visit('/components/preview/dismissable') | ||
cy.get('button.banner__dismiss').first().click() | ||
cy.get('.banner').should('not.exist') | ||
}) | ||
it('stays dismissed', () => { | ||
cy.visit('/components/preview/dismissable') | ||
cy.get('button.banner__dismiss').first().click() | ||
cy.get('.banner').should('not.exist') | ||
cy.reload() | ||
cy.get('.banner').should('not.exist') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
describe('BpDropdown', () => { | ||
it('opens on click', () => { | ||
cy.visit('/components/preview/dropdown') | ||
|
||
cy.get('button[aria-controls="js-about"]').first().click() | ||
cy.get('#js-about').should('be.visible') | ||
}) | ||
|
||
it('closes on escape', () => { | ||
cy.visit('/components/preview/dropdown') | ||
|
||
cy.get('button[aria-controls="js-about"]').first().click() | ||
|
||
cy.get('body').type('{esc}') | ||
cy.get('#js-about').should('be.hidden') | ||
}) | ||
|
||
it('closes on click', () => { | ||
cy.visit('/components/preview/dropdown') | ||
|
||
cy.get('button[aria-controls="js-about"]').first().click() | ||
|
||
cy.get('button[aria-controls="js-about"]').first().click() | ||
cy.get('#js-about').should('be.hidden') | ||
}) | ||
}) |
Oops, something went wrong.