-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from lokesh/dev
chore: Merging dev into master for minor release v2.1
- Loading branch information
Showing
39 changed files
with
3,290 additions
and
10,307 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
|
||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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 @@ | ||
module.exports = { | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2018 | ||
}, | ||
"rules": { | ||
"one-var": ["warn", { "initialized": "never" }] | ||
} | ||
} |
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 @@ | ||
12.4.0 |
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,18 @@ | ||
## Running tests | ||
|
||
Run Cypress integration tests in Chrome browser. | ||
|
||
- `npm run dev` to start local server. | ||
- `npm run test` | ||
|
||
## Adding tests | ||
|
||
- Update `cypress/test-pages/index.html` as needed or create a new test page if you need new examples. | ||
- Add new tests in `cypress/integration/apis_spec.js` | ||
|
||
## Making a new release | ||
|
||
- Update version number in `src/color-thief.js` and `package.json` | ||
- Run `npm run build` | ||
- Push to Github repo | ||
- Create a new Github release along with tag. Naming convention for both ```v2.8.1``` |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,20 @@ | ||
const minify = require('@node-minify/core'); | ||
const uglify = require('@node-minify/uglify-es'); | ||
|
||
minify({ | ||
compressor: uglify, | ||
input: './src/color-thief.js', | ||
output: './dist/color-thief.min.js', | ||
options: { | ||
output: { | ||
comments: 'some' | ||
} | ||
}, | ||
callback: function(err, min) { | ||
if (err) { | ||
console.log('⚠️ERROR:' + err); | ||
} else { | ||
console.log('✅ Minification completed'); | ||
} | ||
} | ||
}); |
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 @@ | ||
{} |
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 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
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,73 @@ | ||
function rgbCount(text) { | ||
const vals = text.split(','); | ||
for (const val of vals) { | ||
if (val < 0 || val > 255) { | ||
throw 'Invalid RGB color value'; | ||
} | ||
} | ||
return vals.length / 3 | ||
} | ||
|
||
describe('getColor()', function() { | ||
beforeEach(function() { | ||
cy.visit('http://localhost:8080/cypress/test-pages/index.html'); | ||
}) | ||
|
||
it('returns valid color from black image', function() { | ||
cy.get('[data-image="black.png"] .output-color').should(($el) => { | ||
const count = rgbCount($el.text()) | ||
expect(count).to.equal(1); | ||
}); | ||
}) | ||
|
||
it('returns valid color from red image', function() { | ||
cy.get('[data-image="red.png"] .output-color').should(($el) => { | ||
const count = rgbCount($el.text()) | ||
expect(count).to.equal(1); | ||
}); | ||
}) | ||
|
||
it('returns valid color from rainbow image', function() { | ||
cy.get('[data-image="rainbow-horizontal.png"] .output-color').should(($el) => { | ||
const count = rgbCount($el.text()) | ||
expect(count).to.equal(1); | ||
}); | ||
}) | ||
|
||
// ⚠️BREAKS | ||
// it('returns valid color from white image', function() { | ||
// cy.get('[data-image="white.png"] .output-color').should(($el) => { | ||
// const count = rgbCount($el.text()) | ||
// expect(count).to.equal(1); | ||
// }); | ||
// }) | ||
|
||
// ⚠️BREAKS | ||
// it('returns valid color from transparent image', function() { | ||
// cy.get('[data-image="transparent.png"] .output-color').should(($el) => { | ||
// const count = rgbCount($el.text()) | ||
// expect(count).to.equal(1); | ||
// }); | ||
// }) | ||
}) | ||
|
||
function testPaletteCount(num) { | ||
it(`returns ${num} color when colorCount set to ${num}`, function() { | ||
cy.get(`[data-image="rainbow-horizontal.png"] .palette[data-count="${num}"] .output-palette`).should(($el) => { | ||
const count = rgbCount($el.text()) | ||
expect(count).to.equal(num); | ||
}); | ||
}) | ||
} | ||
|
||
describe('getPalette()', function() { | ||
beforeEach(function() { | ||
cy.visit('http://localhost:8080/cypress/test-pages/index.html'); | ||
}) | ||
|
||
// FULL TEST LIST = [1, 2, 3, 5, 7, 10, 20]; | ||
|
||
// Non-breaking tests | ||
let testCounts = [5, 7]; | ||
testCounts.forEach((count) => testPaletteCount(count)) | ||
}) |
Oops, something went wrong.