Completely updated React, fixed #11, (hopefully)
This commit is contained in:
		
							
								
								
									
										4
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,4 +0,0 @@ | ||||
| src | ||||
| bench | ||||
| coverage | ||||
| tmp | ||||
							
								
								
									
										4
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/changelog.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/changelog.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,3 +1,7 @@ | ||||
| ## 5.0.0 / 2017-09-30 | ||||
|  | ||||
| - support jss 9 | ||||
|  | ||||
| ## 4.0.0 / 2017-06-20 | ||||
|  | ||||
| - support jss 8 | ||||
|   | ||||
							
								
								
									
										112
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/package.json
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										112
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/package.json
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,43 +1,43 @@ | ||||
| { | ||||
|   "name": "jss-compose", | ||||
|   "description": "JSS plugin for classes composition", | ||||
|   "version": "4.0.0", | ||||
|   "_args": [ | ||||
|     [ | ||||
|       "jss-compose@5.0.0", | ||||
|       "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI" | ||||
|     ] | ||||
|   ], | ||||
|   "_from": "jss-compose@5.0.0", | ||||
|   "_id": "jss-compose@5.0.0", | ||||
|   "_inBundle": false, | ||||
|   "_integrity": "sha512-YofRYuiA0+VbeOw0VjgkyO380sA4+TWDrW52nSluD9n+1FWOlDzNbgpZ/Sb3Y46+DcAbOS21W5jo6SAqUEiuwA==", | ||||
|   "_location": "/material-ui/jss-compose", | ||||
|   "_phantomChildren": {}, | ||||
|   "_requested": { | ||||
|     "type": "version", | ||||
|     "registry": true, | ||||
|     "raw": "jss-compose@5.0.0", | ||||
|     "name": "jss-compose", | ||||
|     "escapedName": "jss-compose", | ||||
|     "rawSpec": "5.0.0", | ||||
|     "saveSpec": null, | ||||
|     "fetchSpec": "5.0.0" | ||||
|   }, | ||||
|   "_requiredBy": [ | ||||
|     "/material-ui/jss-preset-default" | ||||
|   ], | ||||
|   "_resolved": "https://registry.npmjs.org/jss-compose/-/jss-compose-5.0.0.tgz", | ||||
|   "_spec": "5.0.0", | ||||
|   "_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\goTorrentWebUI", | ||||
|   "author": { | ||||
|     "name": "Pavel Davydov", | ||||
|     "email": "typical000@gmail.com" | ||||
|   }, | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
|     "url": "git@github.com:cssinjs/jss-compose.git" | ||||
|   "bugs": { | ||||
|     "url": "https://github.com/cssinjs/jss-compose/issues" | ||||
|   }, | ||||
|   "keywords": [ | ||||
|     "cssinnjs", | ||||
|     "css-in-js", | ||||
|     "css in js", | ||||
|     "jss", | ||||
|     "plugin", | ||||
|     "compose", | ||||
|     "composition" | ||||
|   ], | ||||
|   "scripts": { | ||||
|     "all": "npm run lint && npm run test && npm run build", | ||||
|     "build": "npm run clean && npm run build:lib && npm run build:tests && npm run build:dist", | ||||
|     "build:lib": "babel src --out-dir lib", | ||||
|     "build:tests": "npm run build:tests:lib && npm run build:tests:local", | ||||
|     "build:tests:lib": "cross-env NODE_ENV=test babel src --out-dir tests", | ||||
|     "build:tests:local": "cross-env NODE_ENV=test webpack src/index.test.js tmp/tests.js", | ||||
|     "build:dist": "npm run build:dist:max && npm run build:dist:min", | ||||
|     "build:dist:max": "cross-env NODE_ENV=development webpack src/index.js dist/jss-compose.js", | ||||
|     "build:dist:min": "cross-env NODE_ENV=production webpack src/index.js dist/jss-compose.min.js", | ||||
|     "clean": "rimraf '{lib,dist,tests,tmp}/*'", | ||||
|     "lint": "eslint ./src", | ||||
|     "lint:staged": "lint-staged", | ||||
|     "test": "cross-env NODE_ENV=test karma start --single-run ", | ||||
|     "test:watch": "cross-env NODE_ENV=test karma start", | ||||
|     "prepublishOnly": "npm run all" | ||||
|   "dependencies": { | ||||
|     "warning": "^3.0.0" | ||||
|   }, | ||||
|   "license": "MIT", | ||||
|   "main": "./lib/index.js", | ||||
|   "description": "JSS plugin for classes composition", | ||||
|   "devDependencies": { | ||||
|     "babel-cli": "^6.5.1", | ||||
|     "babel-core": "^6.5.1", | ||||
| @@ -54,7 +54,7 @@ | ||||
|     "eslint-plugin-jsx-a11y": "^2.2.2", | ||||
|     "eslint-plugin-react": "^6.3.0", | ||||
|     "expect.js": "^0.3.1", | ||||
|     "jss": "^8.0.0", | ||||
|     "jss": "^9.0.0", | ||||
|     "karma": "^1.1.1", | ||||
|     "karma-chrome-launcher": "^2.0.0", | ||||
|     "karma-coverage": "^1.1.0", | ||||
| @@ -68,17 +68,49 @@ | ||||
|     "rimraf": "^2.5.4", | ||||
|     "webpack": "^1.12.2" | ||||
|   }, | ||||
|   "peerDependencies": { | ||||
|     "jss": "^8.0.0" | ||||
|   }, | ||||
|   "homepage": "https://github.com/cssinjs/jss-compose#readme", | ||||
|   "keywords": [ | ||||
|     "cssinnjs", | ||||
|     "css-in-js", | ||||
|     "css in js", | ||||
|     "jss", | ||||
|     "plugin", | ||||
|     "compose", | ||||
|     "composition" | ||||
|   ], | ||||
|   "license": "MIT", | ||||
|   "lint-staged": { | ||||
|     "./src/*.js": [ | ||||
|       "eslint", | ||||
|       "git add" | ||||
|     ] | ||||
|   }, | ||||
|   "main": "./lib/index.js", | ||||
|   "name": "jss-compose", | ||||
|   "peerDependencies": { | ||||
|     "jss": "^9.0.0" | ||||
|   }, | ||||
|   "pre-commit": "lint:staged", | ||||
|   "dependencies": { | ||||
|     "warning": "^3.0.0" | ||||
|   } | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
|     "url": "git+ssh://git@github.com/cssinjs/jss-compose.git" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "all": "npm run lint && npm run test && npm run build", | ||||
|     "build": "npm run clean && npm run build:lib && npm run build:tests && npm run build:dist", | ||||
|     "build:dist": "npm run build:dist:max && npm run build:dist:min", | ||||
|     "build:dist:max": "cross-env NODE_ENV=development webpack src/index.js dist/jss-compose.js", | ||||
|     "build:dist:min": "cross-env NODE_ENV=production webpack src/index.js dist/jss-compose.min.js", | ||||
|     "build:lib": "babel src --out-dir lib", | ||||
|     "build:tests": "npm run build:tests:lib && npm run build:tests:local", | ||||
|     "build:tests:lib": "cross-env NODE_ENV=test babel src --out-dir tests", | ||||
|     "build:tests:local": "cross-env NODE_ENV=test webpack src/index.test.js tmp/tests.js", | ||||
|     "clean": "rimraf '{lib,dist,tests,tmp}/*'", | ||||
|     "lint": "eslint ./src", | ||||
|     "lint:staged": "lint-staged", | ||||
|     "prepublishOnly": "npm run all", | ||||
|     "test": "cross-env NODE_ENV=test karma start --single-run ", | ||||
|     "test:watch": "cross-env NODE_ENV=test karma start" | ||||
|   }, | ||||
|   "version": "5.0.0" | ||||
| } | ||||
|   | ||||
							
								
								
									
										236
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/tests/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										236
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/tests/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,236 +0,0 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| Object.defineProperty(exports, "__esModule", { | ||||
|   value: true | ||||
| }); | ||||
| exports.__RewireAPI__ = exports.__ResetDependency__ = exports.__set__ = exports.__Rewire__ = exports.__GetDependency__ = exports.__get__ = undefined; | ||||
|  | ||||
| var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||||
|  | ||||
| exports.default = jssCompose; | ||||
|  | ||||
| var _warning = require('warning'); | ||||
|  | ||||
| var _warning2 = _interopRequireDefault(_warning); | ||||
|  | ||||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||||
|  | ||||
| /** | ||||
|  * Set selector. | ||||
|  * | ||||
|  * @param {Object} original rule | ||||
|  * @param {String} className class string | ||||
|  * @return {Boolean} flag, indicating function was successfull or not | ||||
|  */ | ||||
| function registerClass(rule, className) { | ||||
|   // Skip falsy values | ||||
|   if (!className) return true; | ||||
|  | ||||
|   // Support array of class names `{composes: ['foo', 'bar']}` | ||||
|   if (Array.isArray(className)) { | ||||
|     for (var index = 0; index < className.length; index++) { | ||||
|       var isSetted = _get__('registerClass')(rule, className[index]); | ||||
|       if (!isSetted) return false; | ||||
|     } | ||||
|  | ||||
|     return true; | ||||
|   } | ||||
|  | ||||
|   // Support space separated class names `{composes: 'foo bar'}` | ||||
|   if (className.indexOf(' ') > -1) { | ||||
|     return _get__('registerClass')(rule, className.split(' ')); | ||||
|   } | ||||
|  | ||||
|   var parent = rule.options.parent; | ||||
|  | ||||
|   // It is a ref to a local rule. | ||||
|  | ||||
|   if (className[0] === '$') { | ||||
|     var refRule = parent.getRule(className.substr(1)); | ||||
|  | ||||
|     if (!refRule) { | ||||
|       _get__('warning')(false, '[JSS] Referenced rule is not defined. \r\n%s', rule); | ||||
|       return false; | ||||
|     } | ||||
|  | ||||
|     if (refRule === rule) { | ||||
|       _get__('warning')(false, '[JSS] Cyclic composition detected. \r\n%s', rule); | ||||
|       return false; | ||||
|     } | ||||
|  | ||||
|     parent.classes[rule.key] += ' ' + parent.classes[refRule.key]; | ||||
|  | ||||
|     return true; | ||||
|   } | ||||
|  | ||||
|   rule.options.parent.classes[rule.key] += ' ' + className; | ||||
|  | ||||
|   return true; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Convert compose property to additional class, remove property from original styles. | ||||
|  * | ||||
|  * @param {Rule} rule | ||||
|  * @api public | ||||
|  */ | ||||
| function jssCompose() { | ||||
|   function onProcessStyle(style, rule) { | ||||
|     if (!style.composes) return style; | ||||
|     _get__('registerClass')(rule, style.composes); | ||||
|     // Remove composes property to prevent infinite loop. | ||||
|     delete style.composes; | ||||
|     return style; | ||||
|   } | ||||
|   return { onProcessStyle: onProcessStyle }; | ||||
| } | ||||
|  | ||||
| var _RewiredData__ = Object.create(null); | ||||
|  | ||||
| var INTENTIONAL_UNDEFINED = '__INTENTIONAL_UNDEFINED__'; | ||||
| var _RewireAPI__ = {}; | ||||
|  | ||||
| (function () { | ||||
|   function addPropertyToAPIObject(name, value) { | ||||
|     Object.defineProperty(_RewireAPI__, name, { | ||||
|       value: value, | ||||
|       enumerable: false, | ||||
|       configurable: true | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   addPropertyToAPIObject('__get__', _get__); | ||||
|   addPropertyToAPIObject('__GetDependency__', _get__); | ||||
|   addPropertyToAPIObject('__Rewire__', _set__); | ||||
|   addPropertyToAPIObject('__set__', _set__); | ||||
|   addPropertyToAPIObject('__reset__', _reset__); | ||||
|   addPropertyToAPIObject('__ResetDependency__', _reset__); | ||||
|   addPropertyToAPIObject('__with__', _with__); | ||||
| })(); | ||||
|  | ||||
| function _get__(variableName) { | ||||
|   if (_RewiredData__ === undefined || _RewiredData__[variableName] === undefined) { | ||||
|     return _get_original__(variableName); | ||||
|   } else { | ||||
|     var value = _RewiredData__[variableName]; | ||||
|  | ||||
|     if (value === INTENTIONAL_UNDEFINED) { | ||||
|       return undefined; | ||||
|     } else { | ||||
|       return value; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| function _get_original__(variableName) { | ||||
|   switch (variableName) { | ||||
|     case 'registerClass': | ||||
|       return registerClass; | ||||
|  | ||||
|     case 'warning': | ||||
|       return _warning2.default; | ||||
|   } | ||||
|  | ||||
|   return undefined; | ||||
| } | ||||
|  | ||||
| function _assign__(variableName, value) { | ||||
|   if (_RewiredData__ === undefined || _RewiredData__[variableName] === undefined) { | ||||
|     return _set_original__(variableName, value); | ||||
|   } else { | ||||
|     return _RewiredData__[variableName] = value; | ||||
|   } | ||||
| } | ||||
|  | ||||
| function _set_original__(variableName, _value) { | ||||
|   switch (variableName) {} | ||||
|  | ||||
|   return undefined; | ||||
| } | ||||
|  | ||||
| function _update_operation__(operation, variableName, prefix) { | ||||
|   var oldValue = _get__(variableName); | ||||
|  | ||||
|   var newValue = operation === '++' ? oldValue + 1 : oldValue - 1; | ||||
|  | ||||
|   _assign__(variableName, newValue); | ||||
|  | ||||
|   return prefix ? newValue : oldValue; | ||||
| } | ||||
|  | ||||
| function _set__(variableName, value) { | ||||
|   if ((typeof variableName === 'undefined' ? 'undefined' : _typeof(variableName)) === 'object') { | ||||
|     Object.keys(variableName).forEach(function (name) { | ||||
|       _RewiredData__[name] = variableName[name]; | ||||
|     }); | ||||
|   } else { | ||||
|     if (value === undefined) { | ||||
|       _RewiredData__[variableName] = INTENTIONAL_UNDEFINED; | ||||
|     } else { | ||||
|       _RewiredData__[variableName] = value; | ||||
|     } | ||||
|  | ||||
|     return function () { | ||||
|       _reset__(variableName); | ||||
|     }; | ||||
|   } | ||||
| } | ||||
|  | ||||
| function _reset__(variableName) { | ||||
|   delete _RewiredData__[variableName]; | ||||
| } | ||||
|  | ||||
| function _with__(object) { | ||||
|   var rewiredVariableNames = Object.keys(object); | ||||
|   var previousValues = {}; | ||||
|  | ||||
|   function reset() { | ||||
|     rewiredVariableNames.forEach(function (variableName) { | ||||
|       _RewiredData__[variableName] = previousValues[variableName]; | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   return function (callback) { | ||||
|     rewiredVariableNames.forEach(function (variableName) { | ||||
|       previousValues[variableName] = _RewiredData__[variableName]; | ||||
|       _RewiredData__[variableName] = object[variableName]; | ||||
|     }); | ||||
|     var result = callback(); | ||||
|  | ||||
|     if (!!result && typeof result.then == 'function') { | ||||
|       result.then(reset).catch(reset); | ||||
|     } else { | ||||
|       reset(); | ||||
|     } | ||||
|  | ||||
|     return result; | ||||
|   }; | ||||
| } | ||||
|  | ||||
| var _typeOfOriginalExport = typeof jssCompose === 'undefined' ? 'undefined' : _typeof(jssCompose); | ||||
|  | ||||
| function addNonEnumerableProperty(name, value) { | ||||
|   Object.defineProperty(jssCompose, name, { | ||||
|     value: value, | ||||
|     enumerable: false, | ||||
|     configurable: true | ||||
|   }); | ||||
| } | ||||
|  | ||||
| if ((_typeOfOriginalExport === 'object' || _typeOfOriginalExport === 'function') && Object.isExtensible(jssCompose)) { | ||||
|   addNonEnumerableProperty('__get__', _get__); | ||||
|   addNonEnumerableProperty('__GetDependency__', _get__); | ||||
|   addNonEnumerableProperty('__Rewire__', _set__); | ||||
|   addNonEnumerableProperty('__set__', _set__); | ||||
|   addNonEnumerableProperty('__reset__', _reset__); | ||||
|   addNonEnumerableProperty('__ResetDependency__', _reset__); | ||||
|   addNonEnumerableProperty('__with__', _with__); | ||||
|   addNonEnumerableProperty('__RewireAPI__', _RewireAPI__); | ||||
| } | ||||
|  | ||||
| exports.__get__ = _get__; | ||||
| exports.__GetDependency__ = _get__; | ||||
| exports.__Rewire__ = _set__; | ||||
| exports.__set__ = _set__; | ||||
| exports.__ResetDependency__ = _reset__; | ||||
| exports.__RewireAPI__ = _RewireAPI__; | ||||
							
								
								
									
										387
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/tests/index.test.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										387
									
								
								goTorrentWebUI/node_modules/material-ui/node_modules/jss-compose/tests/index.test.js
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,387 +0,0 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| Object.defineProperty(exports, "__esModule", { | ||||
|   value: true | ||||
| }); | ||||
| exports.__RewireAPI__ = exports.__ResetDependency__ = exports.__set__ = exports.__Rewire__ = exports.__GetDependency__ = exports.__get__ = undefined; | ||||
|  | ||||
| var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; /* eslint-disable no-underscore-dangle */ | ||||
|  | ||||
| var _expect = require('expect.js'); | ||||
|  | ||||
| var _expect2 = _interopRequireDefault(_expect); | ||||
|  | ||||
| var _jss = require('jss'); | ||||
|  | ||||
| var _ = require('./'); | ||||
|  | ||||
| var _2 = _interopRequireDefault(_); | ||||
|  | ||||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||||
|  | ||||
| describe('jss-compose', function () { | ||||
|   var jss = void 0; | ||||
|   var warning = void 0; | ||||
|  | ||||
|   beforeEach(function () { | ||||
|     _get__('compose').__Rewire__('warning', function (condition, message) { | ||||
|       warning = message; | ||||
|     }); | ||||
|     jss = _get__('create')({ | ||||
|       createGenerateClassName: function createGenerateClassName() { | ||||
|         return function (rule) { | ||||
|           return rule.key + '-id'; | ||||
|         }; | ||||
|       } | ||||
|     }).use(_get__('compose')()); | ||||
|   }); | ||||
|  | ||||
|   afterEach(function () { | ||||
|     _get__('compose').__ResetDependency__('warning'); | ||||
|     warning = undefined; | ||||
|   }); | ||||
|  | ||||
|   describe('Ref composition', function () { | ||||
|     var sheet = void 0; | ||||
|  | ||||
|     beforeEach(function () { | ||||
|       sheet = jss.createStyleSheet({ | ||||
|         a: { | ||||
|           float: 'left' | ||||
|         }, | ||||
|         b: { | ||||
|           composes: '$a', | ||||
|           color: 'red' | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|  | ||||
|     afterEach(function () { | ||||
|       _get__('expect')(warning).to.be(undefined); | ||||
|     }); | ||||
|  | ||||
|     it('should add rules', function () { | ||||
|       _get__('expect')(sheet.getRule('a')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('b')).to.not.be(undefined); | ||||
|     }); | ||||
|  | ||||
|     it('should compose classes', function () { | ||||
|       _get__('expect')(sheet.classes.b).to.be('b-id a-id'); | ||||
|     }); | ||||
|  | ||||
|     it('should generate correct CSS', function () { | ||||
|       _get__('expect')(sheet.toString()).to.be('.a-id {\n' + '  float: left;\n' + '}\n' + '.b-id {\n' + '  color: red;\n' + '}'); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('Global class composition', function () { | ||||
|     var sheet = void 0; | ||||
|  | ||||
|     beforeEach(function () { | ||||
|       sheet = jss.createStyleSheet({ | ||||
|         a: { | ||||
|           composes: 'b', | ||||
|           color: 'red' | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|  | ||||
|     afterEach(function () { | ||||
|       _get__('expect')(warning).to.be(undefined); | ||||
|     }); | ||||
|  | ||||
|     it('should compose classes', function () { | ||||
|       _get__('expect')(sheet.classes.a).to.be('a-id b'); | ||||
|     }); | ||||
|  | ||||
|     it('should generate correct CSS', function () { | ||||
|       _get__('expect')(sheet.toString()).to.be('.a-id {\n' + '  color: red;\n' + '}'); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('Array of refs composition', function () { | ||||
|     var sheet = void 0; | ||||
|  | ||||
|     beforeEach(function () { | ||||
|       sheet = jss.createStyleSheet({ | ||||
|         a: { | ||||
|           float: 'left' | ||||
|         }, | ||||
|         b: { | ||||
|           color: 'red' | ||||
|         }, | ||||
|         c: { | ||||
|           background: 'blue' | ||||
|         }, | ||||
|         d: { | ||||
|           composes: ['$a', '$b', '$c'], | ||||
|           border: 'none' | ||||
|         }, | ||||
|         e: { | ||||
|           composes: '$a $b $c', | ||||
|           border: 'none' | ||||
|         }, | ||||
|         f: { | ||||
|           composes: ['$a', ['$b', '$c']], | ||||
|           border: 'none' | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|  | ||||
|     afterEach(function () { | ||||
|       _get__('expect')(warning).to.be(undefined); | ||||
|     }); | ||||
|  | ||||
|     it('should add rules', function () { | ||||
|       _get__('expect')(sheet.getRule('a')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('b')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('c')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('d')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('e')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('f')).to.not.be(undefined); | ||||
|     }); | ||||
|  | ||||
|     it('should compose classes', function () { | ||||
|       _get__('expect')(sheet.classes.d).to.be('d-id a-id b-id c-id'); | ||||
|       _get__('expect')(sheet.classes.e).to.be('e-id a-id b-id c-id'); | ||||
|       _get__('expect')(sheet.classes.f).to.be('f-id a-id b-id c-id'); | ||||
|     }); | ||||
|  | ||||
|     it('should generate correct CSS', function () { | ||||
|       _get__('expect')(sheet.toString()).to.be('.a-id {\n' + '  float: left;\n' + '}\n' + '.b-id {\n' + '  color: red;\n' + '}\n' + '.c-id {\n' + '  background: blue;\n' + '}\n' + '.d-id {\n' + '  border: none;\n' + '}\n' + '.e-id {\n' + '  border: none;\n' + '}\n' + '.f-id {\n' + '  border: none;\n' + '}'); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('Mixed composition', function () { | ||||
|     var sheet = void 0; | ||||
|  | ||||
|     beforeEach(function () { | ||||
|       sheet = jss.createStyleSheet({ | ||||
|         a: { | ||||
|           float: 'left' | ||||
|         }, | ||||
|         b: { | ||||
|           composes: ['$a', 'c', 'd'], | ||||
|           color: 'red' | ||||
|         }, | ||||
|         e: { | ||||
|           composes: '$a c d', | ||||
|           color: 'red' | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|  | ||||
|     afterEach(function () { | ||||
|       _get__('expect')(warning).to.be(undefined); | ||||
|     }); | ||||
|  | ||||
|     it('should add rules', function () { | ||||
|       _get__('expect')(sheet.getRule('a')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('b')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('e')).to.not.be(undefined); | ||||
|     }); | ||||
|  | ||||
|     it('should compose classes', function () { | ||||
|       _get__('expect')(sheet.classes.b).to.be('b-id a-id c d'); | ||||
|       _get__('expect')(sheet.classes.e).to.be('e-id a-id c d'); | ||||
|     }); | ||||
|  | ||||
|     it('should generate correct CSS', function () { | ||||
|       _get__('expect')(sheet.toString()).to.be('.a-id {\n' + '  float: left;\n' + '}\n' + '.b-id {\n' + '  color: red;\n' + '}\n' + '.e-id {\n' + '  color: red;\n' + '}'); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('Nested compositions (compose composed)', function () { | ||||
|     var sheet = void 0; | ||||
|  | ||||
|     beforeEach(function () { | ||||
|       sheet = jss.createStyleSheet({ | ||||
|         a: { | ||||
|           float: 'left' | ||||
|         }, | ||||
|         b: { | ||||
|           composes: ['$a', 'd'], | ||||
|           color: 'red' | ||||
|         }, | ||||
|         c: { | ||||
|           composes: ['$b'], | ||||
|           background: 'blue' | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|  | ||||
|     afterEach(function () { | ||||
|       _get__('expect')(warning).to.be(undefined); | ||||
|     }); | ||||
|  | ||||
|     it('should add rules', function () { | ||||
|       _get__('expect')(sheet.getRule('a')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('b')).to.not.be(undefined); | ||||
|       _get__('expect')(sheet.getRule('c')).to.not.be(undefined); | ||||
|     }); | ||||
|  | ||||
|     it('should compose classes', function () { | ||||
|       _get__('expect')(sheet.classes.b).to.be('b-id a-id d'); | ||||
|       _get__('expect')(sheet.classes.c).to.be('c-id b-id a-id d'); | ||||
|     }); | ||||
|  | ||||
|     it('should generate correct CSS', function () { | ||||
|       _get__('expect')(sheet.toString()).to.be('.a-id {\n' + '  float: left;\n' + '}\n' + '.b-id {\n' + '  color: red;\n' + '}\n' + '.c-id {\n' + '  background: blue;\n' + '}'); | ||||
|     }); | ||||
|   }); | ||||
|  | ||||
|   describe('Warnings', function () { | ||||
|     it('should warn when rule try to compose itself', function () { | ||||
|       jss.createStyleSheet({ | ||||
|         a: { | ||||
|           composes: ['$a'], | ||||
|           color: 'red' | ||||
|         } | ||||
|       }); | ||||
|       _get__('expect')(warning).to.be('[JSS] Cyclic composition detected. \r\n%s'); | ||||
|     }); | ||||
|  | ||||
|     it('should warn when try to compose ref which can\'t be resolved', function () { | ||||
|       jss.createStyleSheet({ | ||||
|         a: { | ||||
|           composes: ['$b'], | ||||
|           color: 'red' | ||||
|         } | ||||
|       }); | ||||
|       _get__('expect')(warning).to.be('[JSS] Referenced rule is not defined. \r\n%s'); | ||||
|     }); | ||||
|   }); | ||||
| }); | ||||
|  | ||||
| var _RewiredData__ = Object.create(null); | ||||
|  | ||||
| var INTENTIONAL_UNDEFINED = '__INTENTIONAL_UNDEFINED__'; | ||||
| var _RewireAPI__ = {}; | ||||
|  | ||||
| (function () { | ||||
|   function addPropertyToAPIObject(name, value) { | ||||
|     Object.defineProperty(_RewireAPI__, name, { | ||||
|       value: value, | ||||
|       enumerable: false, | ||||
|       configurable: true | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   addPropertyToAPIObject('__get__', _get__); | ||||
|   addPropertyToAPIObject('__GetDependency__', _get__); | ||||
|   addPropertyToAPIObject('__Rewire__', _set__); | ||||
|   addPropertyToAPIObject('__set__', _set__); | ||||
|   addPropertyToAPIObject('__reset__', _reset__); | ||||
|   addPropertyToAPIObject('__ResetDependency__', _reset__); | ||||
|   addPropertyToAPIObject('__with__', _with__); | ||||
| })(); | ||||
|  | ||||
| function _get__(variableName) { | ||||
|   if (_RewiredData__ === undefined || _RewiredData__[variableName] === undefined) { | ||||
|     return _get_original__(variableName); | ||||
|   } else { | ||||
|     var value = _RewiredData__[variableName]; | ||||
|  | ||||
|     if (value === INTENTIONAL_UNDEFINED) { | ||||
|       return undefined; | ||||
|     } else { | ||||
|       return value; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| function _get_original__(variableName) { | ||||
|   switch (variableName) { | ||||
|     case 'compose': | ||||
|       return _2.default; | ||||
|  | ||||
|     case 'create': | ||||
|       return _jss.create; | ||||
|  | ||||
|     case 'expect': | ||||
|       return _expect2.default; | ||||
|   } | ||||
|  | ||||
|   return undefined; | ||||
| } | ||||
|  | ||||
| function _assign__(variableName, value) { | ||||
|   if (_RewiredData__ === undefined || _RewiredData__[variableName] === undefined) { | ||||
|     return _set_original__(variableName, value); | ||||
|   } else { | ||||
|     return _RewiredData__[variableName] = value; | ||||
|   } | ||||
| } | ||||
|  | ||||
| function _set_original__(variableName, _value) { | ||||
|   switch (variableName) {} | ||||
|  | ||||
|   return undefined; | ||||
| } | ||||
|  | ||||
| function _update_operation__(operation, variableName, prefix) { | ||||
|   var oldValue = _get__(variableName); | ||||
|  | ||||
|   var newValue = operation === '++' ? oldValue + 1 : oldValue - 1; | ||||
|  | ||||
|   _assign__(variableName, newValue); | ||||
|  | ||||
|   return prefix ? newValue : oldValue; | ||||
| } | ||||
|  | ||||
| function _set__(variableName, value) { | ||||
|   if ((typeof variableName === 'undefined' ? 'undefined' : _typeof(variableName)) === 'object') { | ||||
|     Object.keys(variableName).forEach(function (name) { | ||||
|       _RewiredData__[name] = variableName[name]; | ||||
|     }); | ||||
|   } else { | ||||
|     if (value === undefined) { | ||||
|       _RewiredData__[variableName] = INTENTIONAL_UNDEFINED; | ||||
|     } else { | ||||
|       _RewiredData__[variableName] = value; | ||||
|     } | ||||
|  | ||||
|     return function () { | ||||
|       _reset__(variableName); | ||||
|     }; | ||||
|   } | ||||
| } | ||||
|  | ||||
| function _reset__(variableName) { | ||||
|   delete _RewiredData__[variableName]; | ||||
| } | ||||
|  | ||||
| function _with__(object) { | ||||
|   var rewiredVariableNames = Object.keys(object); | ||||
|   var previousValues = {}; | ||||
|  | ||||
|   function reset() { | ||||
|     rewiredVariableNames.forEach(function (variableName) { | ||||
|       _RewiredData__[variableName] = previousValues[variableName]; | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   return function (callback) { | ||||
|     rewiredVariableNames.forEach(function (variableName) { | ||||
|       previousValues[variableName] = _RewiredData__[variableName]; | ||||
|       _RewiredData__[variableName] = object[variableName]; | ||||
|     }); | ||||
|     var result = callback(); | ||||
|  | ||||
|     if (!!result && typeof result.then == 'function') { | ||||
|       result.then(reset).catch(reset); | ||||
|     } else { | ||||
|       reset(); | ||||
|     } | ||||
|  | ||||
|     return result; | ||||
|   }; | ||||
| } | ||||
|  | ||||
| exports.__get__ = _get__; | ||||
| exports.__GetDependency__ = _get__; | ||||
| exports.__Rewire__ = _set__; | ||||
| exports.__set__ = _set__; | ||||
| exports.__ResetDependency__ = _reset__; | ||||
| exports.__RewireAPI__ = _RewireAPI__; | ||||
| exports.default = _RewireAPI__; | ||||
		Reference in New Issue
	
	Block a user