├── .browserslistrc
├── .editorconfig
├── .eslintrc.js
├── .gitignore
├── .vscode
└── extension.json
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── assets
├── layoutit-grid-addyosmani.PNG
├── layoutit-grid-rob_dodson.PNG
├── layoutit-grid-screenshot.PNG
├── layoutit-grid-showcase-v2.gif
├── layoutit-grid-showcase.gif
└── layoutit-grid-v2-showcase.gif
├── cypress.json
├── cypress
├── fixtures
│ └── example.json
├── integration
│ └── basic_render_page.spec.js
├── plugins
│ └── index.js
└── support
│ ├── commands.js
│ └── index.js
├── index.html
├── jsconfig.json
├── package.json
├── pnpm-lock.yaml
├── postcss.config.js
├── prettier.config.js
├── public
├── browserconfig.xml
├── favicon.ico
├── img
│ ├── icons
│ │ ├── android-icon-144x144.png
│ │ ├── android-icon-192x192.png
│ │ ├── android-icon-36x36.png
│ │ ├── android-icon-48x48.png
│ │ ├── android-icon-512x512.png
│ │ ├── android-icon-72x72.png
│ │ ├── android-icon-96x96.png
│ │ ├── apple-icon-114x114.png
│ │ ├── apple-icon-120x120.png
│ │ ├── apple-icon-144x144.png
│ │ ├── apple-icon-152x152.png
│ │ ├── apple-icon-180x180.png
│ │ ├── apple-icon-57x57.png
│ │ ├── apple-icon-60x60.png
│ │ ├── apple-icon-72x72.png
│ │ ├── apple-icon-76x76.png
│ │ ├── apple-icon-precomposed.png
│ │ ├── apple-icon.png
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon-96x96.png
│ │ ├── icon-128x128.png
│ │ ├── icon-44x44.png
│ │ ├── ms-icon-144x144.png
│ │ ├── ms-icon-150x150.png
│ │ ├── ms-icon-310x310.png
│ │ ├── ms-icon-70x70.png
│ │ └── safari-pinned-tab.svg
│ └── screenshot.png
├── manifest.json
└── robots.txt
├── src
├── App.vue
├── components
│ ├── LayoutEditor.vue
│ ├── MobileButtons.vue
│ ├── area
│ │ ├── AreaBox.vue
│ │ ├── AreaButtons.vue
│ │ ├── AreaEditor.vue
│ │ ├── AreaInfo.vue
│ │ ├── AreaName.vue
│ │ ├── AreaSelection.vue
│ │ ├── ElementButton.vue
│ │ ├── ElementImage.vue
│ │ ├── ElementParagraph.vue
│ │ └── ElementPreview.vue
│ ├── basic
│ │ ├── OptionsButton.vue
│ │ ├── SidebarButton.vue
│ │ ├── SidebarRight.vue
│ │ └── SlideCheckbox.vue
│ ├── code
│ │ ├── CodeEditor.vue
│ │ ├── CodeSanboxButton.vue
│ │ ├── CodepenButton.vue
│ │ ├── CssCodeArea.vue
│ │ ├── CssCodeAreaName.vue
│ │ ├── CssCodeAreaOldSpec.vue
│ │ ├── CssCodeDeclaration.vue
│ │ ├── CssCodeEditor.vue
│ │ ├── CssCodeGap.vue
│ │ ├── CssCodeGridArea.vue
│ │ ├── CssCodeLineName.vue
│ │ ├── CssCodeTemplateAreas.vue
│ │ ├── CssCodeTemplateTracks.vue
│ │ ├── CssCodeTrackSize.vue
│ │ ├── ExportButton.vue
│ │ ├── HtmlCodeArea.vue
│ │ ├── HtmlCodeEditor.vue
│ │ ├── LiveCode.vue
│ │ ├── LiveCodeOptions.vue
│ │ ├── PermalinkBar.vue
│ │ └── StackblitzButton.vue
│ ├── common
│ │ ├── AreaSize.vue
│ │ ├── AreaTypeSelect.vue
│ │ ├── DisplaySelect.vue
│ │ ├── GapInput.vue
│ │ ├── GridAutoFlowSelect.vue
│ │ ├── PlacementPicker.vue
│ │ └── UnitSelect.vue
│ ├── content
│ │ └── PieChart.vue
│ ├── flex
│ │ └── FlexEditor.vue
│ ├── grid
│ │ ├── GridCell.vue
│ │ ├── GridEditor.vue
│ │ ├── GridIntersection.vue
│ │ ├── GridLine.vue
│ │ ├── GridTrack.vue
│ │ ├── GridTrackSize.vue
│ │ ├── LineName.vue
│ │ └── TrackSize.vue
│ ├── icons
│ │ ├── IconAdd.vue
│ │ ├── IconAddArea.vue
│ │ ├── IconAlignAround.vue
│ │ ├── IconAlignBetween.vue
│ │ ├── IconAlignCenter.vue
│ │ ├── IconAlignEnd.vue
│ │ ├── IconAlignEvenly.vue
│ │ ├── IconAlignStart.vue
│ │ ├── IconAlignStretch.vue
│ │ ├── IconClear.vue
│ │ ├── IconCodepen.vue
│ │ ├── IconCodesandbox.vue
│ │ ├── IconDark.vue
│ │ ├── IconEdit.vue
│ │ ├── IconFlex.vue
│ │ ├── IconFlowCol.vue
│ │ ├── IconFlowDense.vue
│ │ ├── IconFlowRow.vue
│ │ ├── IconGithub.vue
│ │ ├── IconJustifyAround.vue
│ │ ├── IconJustifyBetween.vue
│ │ ├── IconJustifyCenter.vue
│ │ ├── IconJustifyEnd.vue
│ │ ├── IconJustifyEvenly.vue
│ │ ├── IconJustifyStart.vue
│ │ ├── IconJustifyStretch.vue
│ │ ├── IconLink.vue
│ │ ├── IconRedo.vue
│ │ ├── IconRefresh.vue
│ │ ├── IconRemove.vue
│ │ ├── IconSidebar.vue
│ │ ├── IconStackblitz.vue
│ │ ├── IconSubgrid.vue
│ │ ├── IconTrash.vue
│ │ └── IconUndo.vue
│ ├── props
│ │ ├── AreaAccordionItem.vue
│ │ ├── AreaBoxProps.vue
│ │ ├── AreaContentProps.vue
│ │ ├── AreaFlexProps.vue
│ │ ├── AreaGridContentPlacementProps.vue
│ │ ├── AreaGridGapProps.vue
│ │ ├── AreaGridImplicitProps.vue
│ │ ├── AreaGridItemsPlacementProps.vue
│ │ ├── AreaGridTemplateProps.vue
│ │ ├── AreaProps.vue
│ │ ├── AreaSelfFlexProps.vue
│ │ ├── AreaSelfGridProps.vue
│ │ ├── AreaTree.vue
│ │ ├── BrandBanner.vue
│ │ ├── BrandLogo.vue
│ │ ├── DarkModeButton.vue
│ │ ├── HireUs.vue
│ │ ├── PropsAccordion.vue
│ │ ├── PropsAccordionItem.vue
│ │ ├── PropsHeader.vue
│ │ ├── PropsSidebar.vue
│ │ └── VersionLabel.vue
│ └── utils
│ │ └── highlight.js
├── composables
│ ├── area.js
│ ├── index.js
│ └── lineName.js
├── generateCode.js
├── main.ts
├── shims-vue.d.ts
├── store.js
├── store
│ ├── area.js
│ ├── flex.js
│ └── grid.ts
├── types.ts
├── types
│ └── area.ts
├── utils.js
└── utils
│ ├── grid.js
│ └── keyMonitor.js
├── tsconfig.json
└── vite.config.ts
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not ie <= 10
4 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 |
2 | root = true
3 |
4 | [*]
5 | indent_size = 2
6 | charset = utf-8
7 | end_of_line = lf
8 | indent_style = space
9 | insert_final_newline = true
10 | trim_trailing_whitespace = true
11 | max_line_length = 120
12 |
13 | [*.md]
14 | max_line_length = off
15 |
16 | [package.json]
17 | indent_style = space
18 | indent_size = 2
19 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true,
5 | },
6 | extends: [
7 | // add more generic rulesets here, such as:
8 | // 'eslint:recommended',
9 | 'plugin:vue/vue3-recommended',
10 | 'prettier',
11 | '@vue/typescript/recommended',
12 | 'plugin:@typescript-eslint/recommended',
13 | ],
14 | parser: 'vue-eslint-parser',
15 | rules: {
16 | 'no-console': 'off',
17 | 'no-debugger': 'off',
18 | 'vue/no-mutating-props': 0,
19 | 'vue/no-setup-props-destructure': 0,
20 | '@typescript-eslint/ban-ts-comment': 'off',
21 | },
22 | parserOptions: {
23 | parser: '@typescript-eslint/parser',
24 | },
25 | }
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 | dist
4 | *.local
5 | .vercel
6 | debug.log
7 | package-lock.json
8 | yarn.lock
9 | # intellij stuff
10 | .idea/
11 | cypress/videos
12 | cypress/screenshots
--------------------------------------------------------------------------------
/.vscode/extension.json:
--------------------------------------------------------------------------------
1 | {
2 | "recomendantions": ["johnsoncodehk.volar"]
3 | }
4 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
2 | # Contributor Covenant Code of Conduct
3 |
4 | ## Our Pledge
5 |
6 | We as members, contributors, and leaders pledge to make participation in our
7 | community a harassment-free experience for everyone, regardless of age, body
8 | size, visible or invisible disability, ethnicity, sex characteristics, gender
9 | identity and expression, level of experience, education, socio-economic status,
10 | nationality, personal appearance, race, religion, or sexual identity
11 | and orientation.
12 |
13 | We pledge to act and interact in ways that contribute to an open, welcoming,
14 | diverse, inclusive, and healthy community.
15 |
16 | ## Our Standards
17 |
18 | Examples of behavior that contributes to a positive environment for our
19 | community include:
20 |
21 | * Demonstrating empathy and kindness toward other people
22 | * Being respectful of differing opinions, viewpoints, and experiences
23 | * Giving and gracefully accepting constructive feedback
24 | * Accepting responsibility and apologizing to those affected by our mistakes,
25 | and learning from the experience
26 | * Focusing on what is best not just for us as individuals, but for the
27 | overall community
28 |
29 | Examples of unacceptable behavior include:
30 |
31 | * The use of sexualized language or imagery, and sexual attention or
32 | advances of any kind
33 | * Trolling, insulting or derogatory comments, and personal or political attacks
34 | * Public or private harassment
35 | * Publishing others' private information, such as a physical or email
36 | address, without their explicit permission
37 | * Other conduct which could reasonably be considered inappropriate in a
38 | professional setting
39 |
40 | ## Enforcement Responsibilities
41 |
42 | Community leaders are responsible for clarifying and enforcing our standards of
43 | acceptable behavior and will take appropriate and fair corrective action in
44 | response to any behavior that they deem inappropriate, threatening, offensive,
45 | or harmful.
46 |
47 | Community leaders have the right and responsibility to remove, edit, or reject
48 | comments, commits, code, wiki edits, issues, and other contributions that are
49 | not aligned to this Code of Conduct, and will communicate reasons for moderation
50 | decisions when appropriate.
51 |
52 | ## Scope
53 |
54 | This Code of Conduct applies within all community spaces, and also applies when
55 | an individual is officially representing the community in public spaces.
56 | Examples of representing our community include using an official e-mail address,
57 | posting via an official social media account, or acting as an appointed
58 | representative at an online or offline event.
59 |
60 | ## Enforcement
61 |
62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
63 | reported to the community leaders responsible for enforcement at
64 | incidents@leniolabs.com.
65 | All complaints will be reviewed and investigated promptly and fairly.
66 |
67 | All community leaders are obligated to respect the privacy and security of the
68 | reporter of any incident.
69 |
70 | ## Enforcement Guidelines
71 |
72 | Community leaders will follow these Community Impact Guidelines in determining
73 | the consequences for any action they deem in violation of this Code of Conduct:
74 |
75 | ### 1. Correction
76 |
77 | **Community Impact**: Use of inappropriate language or other behavior deemed
78 | unprofessional or unwelcome in the community.
79 |
80 | **Consequence**: A private, written warning from community leaders, providing
81 | clarity around the nature of the violation and an explanation of why the
82 | behavior was inappropriate. A public apology may be requested.
83 |
84 | ### 2. Warning
85 |
86 | **Community Impact**: A violation through a single incident or series
87 | of actions.
88 |
89 | **Consequence**: A warning with consequences for continued behavior. No
90 | interaction with the people involved, including unsolicited interaction with
91 | those enforcing the Code of Conduct, for a specified period of time. This
92 | includes avoiding interactions in community spaces as well as external channels
93 | like social media. Violating these terms may lead to a temporary or
94 | permanent ban.
95 |
96 | ### 3. Temporary Ban
97 |
98 | **Community Impact**: A serious violation of community standards, including
99 | sustained inappropriate behavior.
100 |
101 | **Consequence**: A temporary ban from any sort of interaction or public
102 | communication with the community for a specified period of time. No public or
103 | private interaction with the people involved, including unsolicited interaction
104 | with those enforcing the Code of Conduct, is allowed during this period.
105 | Violating these terms may lead to a permanent ban.
106 |
107 | ### 4. Permanent Ban
108 |
109 | **Community Impact**: Demonstrating a pattern of violation of community
110 | standards, including sustained inappropriate behavior, harassment of an
111 | individual, or aggression toward or disparagement of classes of individuals.
112 |
113 | **Consequence**: A permanent ban from any sort of public interaction within
114 | the community.
115 |
116 | ## Attribution
117 |
118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119 | version 2.0, available at
120 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
121 |
122 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
123 | enforcement ladder](https://github.com/mozilla/diversity).
124 |
125 | [homepage]: https://www.contributor-covenant.org
126 |
127 | For answers to common questions about this code of conduct, see the FAQ at
128 | https://www.contributor-covenant.org/faq. Translations are available at
129 | https://www.contributor-covenant.org/translations.
130 |
131 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | ## Setup
4 |
5 | ### Option 1 - Manual
6 |
7 | 1. Fork and clone the repo
8 | 1. Install `pnpm` (https://pnpm.io/installation)
9 | 1. Run `pnpm install` to install dependencies
10 | 1. Create a branch for your PR with `git checkout -b your-branch-name`
11 |
12 | > To keep `main` branch pointing to remote repository and make
13 | > pull requests from branches on your fork. To do this, run:
14 | >
15 | > ```sh
16 | > git remote add upstream https://github.com/Leniolabs/layoutit-grid.git
17 | > git fetch upstream
18 | > git branch --set-upstream-to=upstream/main main
19 | > ```
20 |
21 | ### Option 2 - CodeSandbox
22 |
23 | 1. Go to https://codesandbox.io/s/github/Leniolabs/layoutit-grid
24 | 1. Connect your Github account
25 | 1. Go to Git tab on left side
26 | 1. Tap on `Fork Sandbox`
27 | 1. Write your code
28 | 1. Commit and PR automatically
29 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017-2020 Leniolabs
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Layoutit Grid
2 |
3 | _CSS Grids layouts made easy!_
4 |
5 | _Layoutit grid_ is a CSS Grid layout generator. Quickly design web pages layouts with our clean editor, and get HTML and CSS code to quickstart your next project.
6 |
7 | **Read about the process of [Open Sourcing Layoutit Grid, and why we are using Vue 3 and Vite](https://leniolabs.com/software/development/2020/09/23/open-source-layoutit.html?utm_source=layoutit&utm_medium=banner&utm_campaign=leniolabs&utm_content=grid_github)** :heart:
8 |
9 | ## Use the tool
10 |
11 | Go to https://grid.layoutit.com/ and start playing :dart:
12 |
13 |
14 |
15 | This App is not currently intended to be used as a library, but may in the future. The package in npm is just a placeholder to help discovering the github repository at this point.
16 |
17 | ## Why we built a Generator
18 |
19 | Generators can be a stepping stone when you are learning new concepts. Layoutit Grid helps you experience the power of CSS Grid by materializing your designs in a few clicks along with the code to make it happen. This gives you the early wins that you need to push forward with the learning process. For some of us, generators permanently remain in our toolboxes. Not because we do not know how to craft the layouts by hand, but because having the visual feedback loop help us to quickly convert our ideas into code. So we keep playing with them.
20 |
21 | Read more about [learning CSS Grid visually with a generator here](https://css-tricks.com/layoutit-grid-learning-css-grid-visually-with-a-generator/)
22 |
23 | ## Run it locally
24 |
25 | These instructions will get you a copy of the project up and running on your local machine for development
26 |
27 | ### Clone the repo
28 |
29 | Use ssh
30 |
31 | ```bash
32 | git clone git@github.com:Leniolabs/layoutit-grid.git
33 | ```
34 |
35 | Or https
36 |
37 | ```bash
38 | git clone https://github.com/leniolabs/layoutit-grid.git
39 | ```
40 | ### Run it
41 | 1. Install `pnpm` (https://pnpm.io/installation)
42 | 2. In the repo folder run
43 | ```bash
44 | pnpm install
45 | pnpm start
46 | ```
47 |
48 | Your dev server will start and be running at
49 |
50 | ```bash
51 | > Local: http://localhost:3000/
52 | ```
53 |
54 | #### Commands
55 |
56 | | Command | Description |
57 | | --------------- | ----------------------------- |
58 | | `pnpm install` | Install the dependencies |
59 | | `pnpm start` | Run the project (in dev mode) |
60 | | `pnpm run build` | Build for deployment |
61 |
62 | ## Contributing
63 |
64 | [Ideas](https://github.com/leniolabs/layoutit-grid/issues/new), pull requests and bug reports are welcome.
65 |
66 | ## Libs and Tools used
67 |
68 | - [Vue 3](https://v3.vuejs.org) Vue.js - The Progressive JavaScript Framework.
69 | - [Vueuse](https://vueuse.js.org/) Collection of essential Vue Composition Utilities
70 | - [Vite](https://github.com/vitejs/vite) Next generation frontend tooling. It's fast!
71 | - [vite-plugin-pwa](https://github.com/antfu/vite-plugin-pwa) Zero-config PWA for Vite
72 | - [vite-plugin-components](https://github.com/antfu/vite-plugin-components) On demand components auto importing for Vite
73 |
74 | ## Mentions
75 |
76 |
77 |
78 |
79 |
80 |
81 | ## Creators
82 |
83 | Layoutit grid is crafted with love by [Leniolabs](https://www.leniolabs.com/services/team-augmentation/?utm_source=layoutit&utm_medium=banner&utm_campaign=leniolabs&utm_content=grid_github) and a growing community of contributors. We build digital experiences with your ideas. [Get in touch!](https://www.leniolabs.com/services/team-augmentation/?utm_source=layoutit&utm_medium=banner&utm_campaign=leniolabs&utm_content=grid_github)
--------------------------------------------------------------------------------
/assets/layoutit-grid-addyosmani.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LayoutitStudio/layoutit-grid/bac9964b1d23a361f3ef9e67b0fdd2d990b48a1a/assets/layoutit-grid-addyosmani.PNG
--------------------------------------------------------------------------------
/assets/layoutit-grid-rob_dodson.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LayoutitStudio/layoutit-grid/bac9964b1d23a361f3ef9e67b0fdd2d990b48a1a/assets/layoutit-grid-rob_dodson.PNG
--------------------------------------------------------------------------------
/assets/layoutit-grid-screenshot.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LayoutitStudio/layoutit-grid/bac9964b1d23a361f3ef9e67b0fdd2d990b48a1a/assets/layoutit-grid-screenshot.PNG
--------------------------------------------------------------------------------
/assets/layoutit-grid-showcase-v2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LayoutitStudio/layoutit-grid/bac9964b1d23a361f3ef9e67b0fdd2d990b48a1a/assets/layoutit-grid-showcase-v2.gif
--------------------------------------------------------------------------------
/assets/layoutit-grid-showcase.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LayoutitStudio/layoutit-grid/bac9964b1d23a361f3ef9e67b0fdd2d990b48a1a/assets/layoutit-grid-showcase.gif
--------------------------------------------------------------------------------
/assets/layoutit-grid-v2-showcase.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LayoutitStudio/layoutit-grid/bac9964b1d23a361f3ef9e67b0fdd2d990b48a1a/assets/layoutit-grid-v2-showcase.gif
--------------------------------------------------------------------------------
/cypress.json:
--------------------------------------------------------------------------------
1 | {
2 | "chromeWebSecurity": false
3 | }
--------------------------------------------------------------------------------
/cypress/fixtures/example.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Using fixtures to represent data",
3 | "email": "hello@cypress.io",
4 | "body": "Fixtures are a great way to mock data for responses to routes"
5 | }
6 |
--------------------------------------------------------------------------------
/cypress/integration/basic_render_page.spec.js:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | describe('Layoutit! Basic Page Render', () => {
4 | beforeEach(() => {
5 | cy.openApp()
6 | })
7 |
8 | describe('Sidebar: brand logo', () => {
9 | it('elements should be rendered', () => {
10 | cy.get('.sidebar .sidebar-logo').should('be.visible')
11 | cy.get('.sidebar [data-testid=brand-logo-image]').should('be.visible')
12 | cy.get('.sidebar [data-testid=brand-logo-svg]').should('be.visible')
13 | cy.get('.sidebar [data-testid=version-selector]').should('be.visible')
14 | cy.get('.sidebar [data-testid=version-selector]').should('have.length', 1)
15 | })
16 | it('should display v2 as default version', () => {
17 | cy.get('.sidebar [data-testid=version-selector] option').should('have.length', 2)
18 | cy.get('.sidebar [data-testid=version-selector]').should('have.value', 'v2')
19 | })
20 | it('be able to change the version to v1', () => {
21 | cy.get('.sidebar [data-testid=version-selector]').select('v1')
22 | cy.get('.sidebar [data-testid=version-selector]').should('have.length', 0)
23 | cy.get('h2').contains('Grid Columns') // is not there on v1
24 | })
25 | })
26 | })
27 |
--------------------------------------------------------------------------------
/cypress/plugins/index.js:
--------------------------------------------------------------------------------
1 | ///
2 | // ***********************************************************
3 | // This example plugins/index.js can be used to load plugins
4 | //
5 | // You can change the location of this file or turn off loading
6 | // the plugins file with the 'pluginsFile' configuration option.
7 | //
8 | // You can read more here:
9 | // https://on.cypress.io/plugins-guide
10 | // ***********************************************************
11 |
12 | // This function is called when a project is opened or re-opened (e.g. due to
13 | // the project's config changing)
14 |
15 | /**
16 | * @type {Cypress.PluginConfig}
17 | */
18 | // eslint-disable-next-line no-unused-vars
19 | module.exports = (on, config) => {
20 | // `on` is used to hook into various events Cypress emits
21 | // `config` is the resolved Cypress config
22 | }
23 |
--------------------------------------------------------------------------------
/cypress/support/commands.js:
--------------------------------------------------------------------------------
1 | // ***********************************************
2 | // This example commands.js shows you how to
3 | // create various custom commands and overwrite
4 | // existing commands.
5 | //
6 | // For more comprehensive examples of custom
7 | // commands please read more here:
8 | // https://on.cypress.io/custom-commands
9 | // ***********************************************
10 | //
11 | //
12 | const local = 'http://localhost:3000'
13 | Cypress.Commands.add('openApp', () => {
14 | cy.visit(local)
15 | })
16 |
--------------------------------------------------------------------------------
/cypress/support/index.js:
--------------------------------------------------------------------------------
1 | // ***********************************************************
2 | // This example support/index.js is processed and
3 | // loaded automatically before your test files.
4 | //
5 | // This is a great place to put global configuration and
6 | // behavior that modifies Cypress.
7 | //
8 | // You can change the location of this file or turn off
9 | // automatically serving support files with the
10 | // 'supportFile' configuration option.
11 | //
12 | // You can read more here:
13 | // https://on.cypress.io/configuration
14 | // ***********************************************************
15 |
16 | // Import commands.js using ES2015 syntax:
17 | import './commands'
18 |
19 | // Alternatively you can use CommonJS syntax:
20 | // require('./commands')
21 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |