Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
hex-to-rgb-jquery
Advanced tools
Unit testing helper function that converts hex colors to rgb colors
Unit testing helper function that converts hex colors to rgb colors
hex-to-rgb-jquery is a wrapper for onecolor that adjusts its response so it matches the rgb format jQuery returns.
$ npm install hex-to-rgb-jquery --save-dev
Add the following script tag to your unit test runner.
<script src="../node_modules/hex-to-rgb-jquery/dist/hex-to-rgb.js"></script>
Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test Runner</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
<!-- lib scripts -->
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>
<!-- hex-to-rgb script -->
<script src="../node_modules/hex-to-rgb-jquery/dist/hex-to-rgb.js"></script>
<!-- Mocha setup -->
<script type="text/javascript">
chai.should();
mocha.setup('bdd');
// Start the suite.
window.onload = function() {
mocha.run();
};
</script>
</head>
<body>
<div id="mocha"></div>
<div id="fixture"></div>
<!-- source code scripts -->
<!-- test scripts -->
</body>
</html>
Call the function in the test
window.hexToRgbJquery.hexToRgb('#fff');
Ex in context of a test:
var hexToRgb = window.hexToRgbJquery.hexToRgb;
describe('hex-to-rgb tests', function() {
context('when a hex value is passed', function() {
it('with all six characters a valid corresponding rgb value should be returned', function() {
hexToRgb('#f1f1f1').should.equal('rgb(241, 241, 241)');
});
});
});
Please see CONTRIBUTING.md.
Please see CHANGELOG.md.
Copyright (c) 2017 Thomas Lindner. Licensed under the MIT license.
FAQs
Unit testing helper function that converts hex colors to rgb colors
The npm package hex-to-rgb-jquery receives a total of 2 weekly downloads. As such, hex-to-rgb-jquery popularity was classified as not popular.
We found that hex-to-rgb-jquery demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.