added unit testing, and started implementing unit tests...phew

This commit is contained in:
Josh Burman
2019-03-12 22:28:02 -04:00
parent 74aad4a957
commit e8c2539f1b
3489 changed files with 464813 additions and 88 deletions

3
node_modules/colornames/.npmignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
components
build
node_modules

4
node_modules/colornames/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,4 @@
language: node_js
node_js:
- "stable"
- "4.2"

21
node_modules/colornames/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Tim Oxley
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

11
node_modules/colornames/Makefile generated vendored Normal file
View File

@ -0,0 +1,11 @@
build: components index.js
@component build --dev
components: component.json
@component install --dev
clean:
rm -fr build components template.js
.PHONY: clean

83
node_modules/colornames/Readme.md generated vendored Normal file
View File

@ -0,0 +1,83 @@
# colornames
Convert color names to HEX color values.
[![NPM](https://nodei.co/npm/colornames.png)](https://nodei.co/npm/colornames/)
[![Build Status](https://travis-ci.org/timoxley/colornames.png?branch=master)](https://travis-ci.org/timoxley/colornames)
[![Dependency Status](https://david-dm.org/timoxley/colornames.png)](https://david-dm.org/timoxley/colornames)
## Installation
### Component
$ component install timoxley/colornames
### Node/Browserify
$ npm install colornames
## Example
```js
var toHex = require('colornames')
```
### VGA color names
```js
toHex('red') // => "#FF0000"
toHex('blue') // => "#0000FF"
```
### CSS color names
```js
toHex('lightsalmon') // => "#FFA07A"
toHex('mediumvioletred') // => "#C71585"
```
### Get meta data about a color
```js
toHex.get('red')
// =>
{
name: "red",
css: true,
value: "#FF0000",
vga: true
}
```
### Conversion is case-insensitive
```js
toHex('Blue') // => "#0000FF"
toHex('BLUE') // => "#0000FF"
toHex('BlUe') // => "#0000FF"
```
## API
### colornames(name)
Get HEX code for a color name, or `undefined` if unknown.
### .get(name)
All known data about color, including whether valid VGA or CSS color
name.
### .get.vga(name)
HEX code for a color name, only if the color is a valid VGA color
name.
### .get.css(name)
HEX code for a color name, only if the color is a valid CSS color
name.
###.all()
Get all color names data.
## License
MIT
## Complete Color Map
![example-color-table-](https://f.cloud.github.com/assets/43438/643981/f57948a0-d381-11e2-99fd-197c44065564.png)

2535
node_modules/colornames/colors.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

18
node_modules/colornames/component.json generated vendored Normal file
View File

@ -0,0 +1,18 @@
{
"name": "colornames",
"repo": "timoxley/colornames",
"description": "Map of CSS colors/names",
"version": "1.0.0",
"keywords": [],
"dependencies": {},
"development": {
"component/domify": "*",
"component/classes": "*",
"timoxley/to-array": "*"
},
"license": "MIT",
"scripts": [
"index.js",
"colors.js"
]
}

94
node_modules/colornames/example/color-table/index.html generated vendored Normal file
View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../../build/build.css" >
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap.no-responsive.no-icons.min.css" rel="stylesheet">
</head>
<body class="light">
<div class="navbar navbar-fixed-bottom">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="#">Colors</a>
<ul class="nav pull-right">
<li><a href="#" id="toggle" class="btn">Toggle Background Color</a></li>
</ul>
</div>
</div>
</div>
<div id="content"></div>
<script src="../../build/build.js"></script>
<style>
.color {
float: left;
height: 70px;
width: 70px;
text-align: center;
padding: 50px;
margin: 10px;
clear: both;
}
.info {
}
.color:hover .info {
}
.color .badge {
margin-bottom: 5px;
}
.light {
background-color: white;
transition: background-color 0.2s ease-out;
-webkit-transition: background-color 0.2s ease-out;
}
.dark {
background-color: black;
transition: background-color 0.2s ease-out;
-webkit-transition: background-color 0.2s ease-out;
}
.hide {
}
.show {
}
</style>
<script>
var allColors = require('colors').all()
var domify = require('component-domify')
var classes = require('component-classes')
var toArray = require('timoxley-to-array')
var toggle = document.getElementById('toggle')
var content = document.getElementById('content')
toggle.addEventListener('click', function(e) {
e.preventDefault()
classes(toggle).toggle('active')
classes(document.body).toggle('dark')
classes(document.body).toggle('light')
})
function render(colorList) {
allColors.forEach(renderOne)
}
function renderOne(color) {
content.appendChild(domify([
'<div ',
'style="background-color: '+color.value+'" ',
'class="row color ',
color.css ? 'css ' : '',
color.vga ? 'vga ' : '',
'show">',
' <div class="info">',
' <div class="">'+color.name+'</div>',
' </div>',
'</div>'
].join(''))[0])
}
render(allColors)
</script>
</body>
</html>

79
node_modules/colornames/index.js generated vendored Normal file
View File

@ -0,0 +1,79 @@
/**
* Module dependencies
*/
var colors = require('./colors')
var cssColors = colors.filter(function(color){
return !! color.css
})
var vgaColors = colors.filter(function(color){
return !! color.vga
})
/**
* Get color value for a certain name.
* @param name {String}
* @return {String} Hex color value
* @api public
*/
module.exports = function(name) {
var color = module.exports.get(name)
return color && color.value
}
/**
* Get color object.
*
* @param name {String}
* @return {Object} Color object
* @api public
*/
module.exports.get = function(name) {
name = name || ''
name = name.trim().toLowerCase()
return colors.filter(function(color){
return color.name.toLowerCase() === name
}).pop()
}
/**
* Get all color object.
*
* @return {Array}
* @api public
*/
module.exports.all = module.exports.get.all = function() {
return colors
}
/**
* Get color object compatible with CSS.
*
* @return {Array}
* @api public
*/
module.exports.get.css = function(name) {
if (!name) return cssColors
name = name || ''
name = name.trim().toLowerCase()
return cssColors.filter(function(color){
return color.name.toLowerCase() === name
}).pop()
}
module.exports.get.vga = function(name) {
if (!name) return vgaColors
name = name || ''
name = name.trim().toLowerCase()
return vgaColors.filter(function(color){
return color.name.toLowerCase() === name
}).pop()
}

61
node_modules/colornames/package.json generated vendored Normal file
View File

@ -0,0 +1,61 @@
{
"_from": "colornames@^1.1.1",
"_id": "colornames@1.1.1",
"_inBundle": false,
"_integrity": "sha1-+IiQMGhcfE/54qVZ9Qd+t2qBb5Y=",
"_location": "/colornames",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "colornames@^1.1.1",
"name": "colornames",
"escapedName": "colornames",
"rawSpec": "^1.1.1",
"saveSpec": null,
"fetchSpec": "^1.1.1"
},
"_requiredBy": [
"/kuler"
],
"_resolved": "https://registry.npmjs.org/colornames/-/colornames-1.1.1.tgz",
"_shasum": "f8889030685c7c4ff9e2a559f5077eb76a816f96",
"_spec": "colornames@^1.1.1",
"_where": "/Users/josh.burman/Projects/braid/node_modules/kuler",
"author": {
"name": "Tim Oxley"
},
"bugs": {
"url": "https://github.com/timoxley/colornames/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Map color names to HEX color values.",
"devDependencies": {
"tape": "^4.4.0"
},
"directories": {
"example": "example"
},
"homepage": "https://github.com/timoxley/colornames#readme",
"keywords": [
"color",
"colour",
"names",
"css",
"hex",
"rgb",
"convert"
],
"license": "MIT",
"main": "index.js",
"name": "colornames",
"repository": {
"type": "git",
"url": "git://github.com/timoxley/colornames.git"
},
"scripts": {
"test": "node test.js"
},
"version": "1.1.1"
}

33
node_modules/colornames/test.js generated vendored Normal file
View File

@ -0,0 +1,33 @@
var test = require('tape')
var toHex = require('./index.js')
test('maps VGA color names to HEX values', function(t) {
t.plan(3)
t.equal(toHex('red'), '#FF0000')
t.equal(toHex('blue'), '#0000FF')
t.equal(toHex('BluE'), '#0000FF')
})
test('maps CSS color names to HEX values', function(t) {
t.plan(3)
t.equal(toHex('lightsalmon'), '#FFA07A')
t.equal(toHex('mediumvioletred'), '#C71585')
t.equal(toHex('meDiumVioletRed'), '#C71585')
})
test('meta data about a color', function(t) {
t.plan(2)
t.deepEqual(toHex.get('red'), {
name: "red",
css: true,
value: "#FF0000",
vga: true
})
t.deepEqual(toHex.get('rEd'), {
name: "red",
css: true,
value: "#FF0000",
vga: true
})
})