Skip to content

Commit 68fbfa4

Browse files
authored
Merge pull request #10 from creativecommons/master
Fork Updated
2 parents a8138b9 + a127966 commit 68fbfa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1454
-1126
lines changed

.github/workflows/pull_request.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,16 @@ jobs:
2121
- name: Run npm install
2222
run: npm ci
2323

24-
# After the site is built, we delete the old docs folder,
25-
# add CNAME file to dist folder, and rename it to docs.
2624
- name: Build
2725
run: |
2826
npm run build
29-
echo "chooser-beta.creativecommons.org" > "./dist/CNAME"
30-
rm -r -f "./docs"
31-
mv -f -v "./dist" "./docs"
3227
3328
- name: Commit changes
3429
uses: EndBug/add-and-commit@v4
3530
with:
36-
author_name: obulat
37-
author_email: obulat@gmail.com
38-
message: "Publish site"
31+
author_name: cc-open-source-bot
32+
author_email: opensource@creativecommons.org
33+
message: "Deploy site"
3934
add: "./docs"
4035
env:
4136
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
dist/
55
coverage/
66
node_modules/
7+
yarn.lock

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# chooser
22

3-
The Creative Commons License Chooser is meant to help people learn about CC licenses, and select the license that best fits their needs. The new version in this repo places greater importance on usability and an educational experience of the six CC licenses.
3+
The Creative Commons License Chooser is meant to help people learn about CC licenses, and select the license that best fits their needs. The new version in this repo places greater importance on usability, and an educational experience of the six CC licenses.
44

55
## About
66
Repository containing the source code for the new Creative Commons License Chooser. The new chooser is still in beta, and a beta deployment can be found [here](https://chooser-beta.creativecommons.org/).
77

8-
This site is built using [Vue.js](https://vuejs.org/) (and vue-cli), and [Buefy](https://buefy.org/), among other things.
8+
This site is built using [Vue.js](https://vuejs.org/) (and vue-cli).
99

1010
#### Roadmap
1111

@@ -26,7 +26,7 @@ You should now have the application running and accessible at http://localhost:8
2626
## Contributing
2727
For information on contributing, please see [Creative Commons' Contribution Guidelines](https://opensource.creativecommons.org/contributing-code/)
2828

29-
If you create a PR for your work, but you are not finished yet, please include `WIP:` in the beginning of your PR title. When your work on your PR is completed and you are ready for a final review, please remove the `WIP:` prefix from the title to indicate that your work is done.
29+
If you create a PR for your work, but you are not finished yet, please include `WIP:` in the beginning of your PR title. When your work on your PR is completed, and you are ready for a final review, please remove the `WIP:` prefix from the title to indicate that your work is done.
3030

3131
Here's a [handy link](https://github.com/creativecommons/chooser/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22+-label%3A%22in+progress%22) that will show you all open issues in this repo that have the `help wanted` tag, but do not have the `in progress` tag.
3232
All issues in this list are up for grabs!
@@ -46,6 +46,6 @@ To run e2e tests, you must have Java installed. [[download Java here](https://ja
4646
The Chooser uses PostCSS plugin for PurgeCSS to make CSS bundle size smaller. It automatically removes unused CSS based on the classes found in the final built bundle. Some styles for dynamic components or dynamically-imported files can also be removed. If you find that the built site misses some styles, you can manually add the necessary classes or Regex expressions to the `safelist` array in the `postcss.config.js` file.
4747

4848
## Deployment
49-
The chooser is deployed to GitHub Pages. The source files for the beta deployment are contained in the `./docs/` dir, and are live. Any changes to this dir's contents will be automatically deployed, so please take care when making modifications to this location.
49+
The chooser is deployed to GitHub Pages. The source files for the beta deployment are contained in the `./docs/` dir, and are live. Any changes to this directory's contents will be automatically deployed, so please take care when making modifications to this location.
5050

51-
To update the dist bundle, run ```$ npm run build```. This and copy the generated files from `./dist/` to `./docs/`, taking care to not delete the CNAME file in `./docs/`.
51+
To update the dist bundle, run ```$ npm run build```. This will also automatically copy the generated files from `./dist/` to `./docs/`.

cypress.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
{}
1+
{
2+
"project": "creativecommons-chooser",
3+
"baseUrl": "http://localhost:8080/"
4+
}

cypress/integration/Stepper._spec.js

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
/* This Source Code Form is subject to the terms of the Creative Commons
2+
* License Chooser
3+
*/
4+
5+
describe('Stepper.vue', () => {
6+
describe('User can select licenses using the dropdown', () => {
7+
it('Selecting CC0', () => {
8+
cy.visit('/')
9+
cy.makeAChoice('.FS', 'yes')
10+
cy.clickNext()
11+
cy.get('select').select('CC0 1.0')
12+
cy.hasRecommendedLicense('CC0 1.0 Universal')
13+
cy.hasStepsCount(4)
14+
cy.clickNext()
15+
cy.waiveCopyright()
16+
cy.clickNext()
17+
cy.hasLicenseInAttributionCode(' CC0 1.0 ')
18+
})
19+
20+
it('Selecting CC BY-NC-ND', () => {
21+
cy.visit('/')
22+
cy.makeAChoice('.FS', 'yes')
23+
cy.clickNext()
24+
cy.get('select').select('CC BY-NC-ND 4.0')
25+
cy.hasRecommendedLicense('CC BY-NC-ND 4.0')
26+
cy.hasStepsCount(3)
27+
cy.clickNext()
28+
cy.hasLicenseInAttributionCode('CC BY-NC-ND 4.0')
29+
})
30+
})
31+
32+
describe('User can select a license using the steps', () => {
33+
it('Selecting CC0', () => {
34+
cy.visit('/')
35+
cy.makeAChoice('.FS', 'no')
36+
cy.clickNext()
37+
cy.makeAChoice('.BY', 'no')
38+
cy.hasRecommendedLicense('CC0 1.0 Universal')
39+
cy.hasStepsCount(7)
40+
cy.clickNext()
41+
cy.get('.NC').should('have.class', 'disabled')
42+
cy.get('.ND').should('have.class', 'disabled')
43+
cy.get('.SA').should('have.class', 'disabled')
44+
cy.waiveCopyright()
45+
cy.clickNext()
46+
cy.hasLicenseInAttributionCode(' CC0 1.0 ')
47+
})
48+
49+
it('Selecting CC BY', () => {
50+
cy.visit('/')
51+
cy.makeAChoice('.FS', 'no')
52+
cy.clickNext()
53+
cy.makeAChoice('.BY', 'yes')
54+
cy.hasRecommendedLicense('CC BY 4.0')
55+
cy.hasStepsCount(6)
56+
cy.clickNext()
57+
cy.makeAChoice('.NC', 'yes')
58+
cy.clickNext()
59+
cy.makeAChoice('.ND', 'yes')
60+
cy.clickNext()
61+
cy.makeAChoice('.SA', 'yes')
62+
cy.get('.AD').should('be.visible')
63+
cy.clickNext()
64+
cy.hasLicenseInAttributionCode('CC BY 4.0')
65+
})
66+
67+
it('Selecting CC BY-NC-ND', () => {
68+
cy.visit('/')
69+
cy.makeAChoice('.FS', 'no')
70+
cy.clickNext()
71+
cy.makeAChoice('.BY', 'yes')
72+
cy.hasRecommendedLicense('CC BY 4.0')
73+
cy.clickNext()
74+
cy.makeAChoice('.NC', 'no')
75+
cy.hasRecommendedLicense('CC BY-NC 4.0')
76+
cy.clickNext()
77+
cy.makeAChoice('.ND', 'no')
78+
cy.hasRecommendedLicense('CC BY-NC-ND 4.0')
79+
cy.clickNext()
80+
cy.get('.SA').should('have.class', 'disabled')
81+
cy.hasLicenseInAttributionCode('CC BY-NC-ND 4.0')
82+
})
83+
84+
it('Can select CC BY-ND', () => {
85+
cy.visit('/')
86+
cy.makeAChoice('.FS', 'no')
87+
cy.clickNext()
88+
cy.makeAChoice('.BY', 'yes')
89+
cy.hasRecommendedLicense('CC BY 4.0')
90+
cy.clickNext()
91+
cy.makeAChoice('.NC', 'yes')
92+
cy.clickNext()
93+
cy.makeAChoice('.ND', 'no')
94+
cy.hasRecommendedLicense('CC BY-ND 4.0')
95+
cy.clickNext()
96+
cy.get('.SA').should('have.class', 'disabled')
97+
cy.hasLicenseInAttributionCode('CC BY-ND 4.0')
98+
})
99+
})
100+
101+
describe('"Back", "Done" and "Start again" buttons work correctly', () => {
102+
it('User can select CC BY-ND, go back and change selection to CC BY-SA', () => {
103+
cy.clickBack()
104+
cy.makeAChoice('.ND', 'yes')
105+
cy.clickNext()
106+
cy.makeAChoice('.SA', 'no')
107+
cy.clickNext()
108+
cy.hasRecommendedLicense('CC BY-SA 4.0')
109+
cy.get('.AD').should('be.visible')
110+
cy.hasLicenseInAttributionCode('CC BY-SA 4.0')
111+
})
112+
113+
it('User can select CCO using the License Dropdown, go back and select CC BY-NC-SA using steps', () => {
114+
cy.visit('/')
115+
cy.makeAChoice('.FS', 'yes')
116+
cy.clickNext()
117+
cy.get('select').select('CC0 1.0')
118+
cy.hasRecommendedLicense('CC0 1.0 Universal')
119+
cy.clickNext()
120+
cy.waiveCopyright()
121+
cy.clickNext()
122+
cy.hasLicenseInAttributionCode(' CC0 1.0 ')
123+
cy.clickBack()
124+
cy.clickBack()
125+
cy.clickBack()
126+
cy.makeAChoice('.FS', 'no')
127+
cy.clickNext()
128+
cy.makeAChoice('.BY', 'yes')
129+
cy.hasRecommendedLicense('CC BY 4.0')
130+
cy.clickNext()
131+
cy.makeAChoice('.NC', 'yes')
132+
cy.clickNext()
133+
cy.makeAChoice('.ND', 'yes')
134+
cy.clickNext()
135+
cy.makeAChoice('.SA', 'no')
136+
cy.hasRecommendedLicense('CC BY-SA 4.0')
137+
cy.clickNext()
138+
cy.hasLicenseInAttributionCode('CC BY-SA 4.0')
139+
})
140+
141+
it('User can start the selection process over by clicking "Start again" Button', () => {
142+
cy.get('button').contains('Start again').click()
143+
cy.get('.right-column').find('.recommended-card').should('not.exist')
144+
cy.get('.right-column').find('.license-use-card').should('not.exist')
145+
cy.get('.BY').should('have.class', 'inactive')
146+
cy.get('.NC').should('have.class', 'inactive')
147+
cy.get('.ND').should('have.class', 'inactive')
148+
cy.get('.SA').should('have.class', 'inactive')
149+
})
150+
151+
it('Chooser auto-scrolls to "Mark Your Work" section when "Done" is clicked', () => {
152+
cy.visit('/')
153+
cy.viewport('iphone-x')
154+
cy.makeAChoice('.FS', 'no')
155+
cy.clickNext()
156+
cy.makeAChoice('.BY', 'yes')
157+
cy.clickNext()
158+
cy.makeAChoice('.NC', 'yes')
159+
cy.clickNext()
160+
cy.makeAChoice('.ND', 'no')
161+
cy.clickNext()
162+
cy.get('.SA').should('have.class', 'disabled')
163+
cy.hasRecommendedLicense('CC BY-ND 4.0')
164+
cy.window().then(($window) => {
165+
expect($window.scrollY).to.be.closeTo(800, 300)
166+
})
167+
cy.get('button').contains('DONE').click()
168+
cy.hasLicenseInAttributionCode('CC BY-ND 4.0')
169+
cy.window().then(($window) => {
170+
expect($window.scrollY).to.be.closeTo(1400, 300)
171+
})
172+
})
173+
})
174+
})

cypress/support/commands.js

+27
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,30 @@
2323
//
2424
// -- This will overwrite an existing command --
2525
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
26+
27+
Cypress.Commands.add("clickNext", () => {
28+
cy.get('button').contains('NEXT').click()
29+
})
30+
Cypress.Commands.add("clickBack", () => {
31+
cy.get('button').contains('BACK').click()
32+
})
33+
34+
Cypress.Commands.add("makeAChoice", (stepId, choice) => {
35+
cy.get(stepId).find(`[value="${choice}"]`).check()
36+
})
37+
38+
Cypress.Commands.add('waiveCopyright', () => {
39+
cy.get('.v-checkbox:nth-child(1) > input').check()
40+
cy.get('.v-checkbox:nth-child(2) > input').check()
41+
})
42+
43+
Cypress.Commands.add('hasRecommendedLicense', (license) => {
44+
cy.get('.recommended-card').should('be.visible').contains(license)
45+
})
46+
47+
Cypress.Commands.add('hasLicenseInAttributionCode', (license) => {
48+
cy.get('.license-use-card').should('be.visible').contains(license)
49+
})
50+
Cypress.Commands.add('hasStepsCount', (stepsCount) => {
51+
cy.get('.stepper__container').find('.step-container').should('have.lengthOf', stepsCount)
52+
})

docs/CNAME

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
chooser-beta.creativecommons.org
1+
chooser-beta.creativecommons.org

0 commit comments

Comments
 (0)