8000 Refactor Image component (#167) · cloudinary/cloudinary-react@96af98b · GitHub
[go: up one dir, main page]

Skip to content

Commit 96af98b

Browse files
author
Nir Maoz
authored
Refactor Image component (#167)
1 parent ccd34c7 commit 96af98b

39 files changed

+685
-535
lines changed

.npmignore

Lines changed: 0 additions & 58 deletions
This file was deleted.

.npmrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
2-
package-lock=false
1+
package-lock=false

.travis.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ node_js:
55
- "lts/*"
66
before_script:
77
- npm run build
8-
env:
9-
- TEST_SUBJECT=src
10-
- TEST_SUBJECT=lib
11-
- TEST_SUBJECT=dist
8+
jobs:
9+
- name: "src"
10+
env: TEST_SUBJECT=src
11+
- name: "lib"
12+
env: TEST_SUBJECT=lib
13+
- name: "dist"
14+
env: TEST_SUBJECT=dist
15+
- name: "e2e"
16+
script: yarn run test:e2e

e2e-test/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true

e2e-test/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

e2e-test/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

e2e-test/cypress.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"baseUrl": "http://localhost:3000",
3+
"video": false
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('Cypress', () => {
2+
it('is working', () => {
3+
expect(true).to.equal(true)
4+
})
5+
})
6+
7+
it('visits the app', () => {
8+
cy.visit('/')
9+
})
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
describe('Responsive Image', () => {
2+
it('Responsive Image', () => {
3+
cy.visit('/');
4+
5+
cy.get('#responsive')
6+
.should('have.attr', 'data-src').should('equal','http://res.cloudinary.com/demo/image/upload/c_scale,w_auto/sample')
7+
cy.get('#responsive')
8+
.should('have.attr', 'src').should('equal','http://res.cloudinary.com/demo/image/upload/c_scale,w_400/sample')
9+
});
10+
it('Disabled Breakpoints', () => {
11+
cy.visit('/');
12+
13+
cy.get('#responsive')
14+
.should('have.attr', 'data-src').should('equal','http://res.cloudinary.com/demo/image/upload/c_scale,w_auto/sample')
15+
cy.get('#disable-breakpoints')
16+
.should('have.attr', 'src').should('equal','http://res.cloudinary.com/demo/image/upload/c_scale,w_330/sample')
17+
});
18+
it('Enabled Breakpoints', () => {
19+
cy.visit('/');
20+
21+
cy.get('#responsive')
22+
.should('have.attr', 'data-src').should('equal','http://res.cloudinary.com/demo/image/upload/c_scale,w_auto/sample')
23+
cy.get('#breakpoints')
24+
.should('have.attr', 'src').should('equal','http://res.cloudinary.com/demo/image/upload/c_scale,w_450/sample')
25+
});
26+
27+
28+
29+
});

e2e-test/package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "e2e-test",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@testing-library/jest-dom": "^4.2.4",
7+
"@testing-library/react": "^9.3.2",
8+
"@testing-library/user-event": "^7.1.2",
9+
"cloudinary-react": "file:cloudinary-react.tgz",
10+
"react": "^16.13.1",
11+
"react-dom": "^16.13.1",
12+
"react-scripts": "3.4.1"
13+
},
14+
"scripts": {
15+
"start": "react-scripts start",
16+
"build": "react-scripts build",
17+
"cypress": "./node_modules/.bin/cypress run",
18+
"pretest": "npm install",
19+
"test": "start-server-and-test start http://localhost:3000 cypress",
20+
"eject": "react-scripts eject"
21+
},
22+
"eslintConfig": {
23+
"extends": "react-app"
24+
},
25+
"browserslist": {
26+
"production": [
27+
">0.2%",
28+
"not dead",
29+
"not op_mini all"
30+
],
31+
"development": [
32+
"last 1 chrome version",
33+
"last 1 firefox version",
34+
"last 1 safari version"
35+
]
36+
},
37+
"devDependencies": {
38+
"cypress": "^4.9.0",
39+
"start-server-and-test": "^1.11.0"
40+
}
41+
}

0 commit comments

Comments
 (0)
0