Skip to content

Commit

Permalink
fix vr-object tests, getting baseline tests back up and running (afra…
Browse files Browse the repository at this point in the history
  • Loading branch information
ngokevin committed Nov 14, 2015
1 parent 71b3ea4 commit 801bbfc
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 552 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
"garnish": "^3.2.0",
"gh-pages": "^0.4.0",
"husky": "^0.10.1",
"karma": "^0.13.9",
"karma-browserify": "4.3.0",
"karma": "^0.13.15",
"karma-browserify": "^4.4.0",
"karma-chai-shallow-deep-equal": "0.0.4",
"karma-firefox-launcher": "^0.1.4",
"karma-firefox-launcher": "^0.1.6",
"karma-mocha": "^0.2.0",
"karma-mocha-reporter": "^1.1.0",
"karma-sinon-chai": "^1.1.0",
Expand All @@ -46,8 +46,8 @@
"ghpages": "node ./scripts/gh-pages",
"gh-pages": "npm run ghpages",
"release": "npm login && npm version patch --minor && npm publish",
"test": "karma start ./test/karma.conf.js",
"test:ci": "karma start ./test/karma.conf.js --single-run",
"test": "karma start ./tests/karma.conf.js",
"test:ci": "karma start ./tests/karma.conf.js --single-run",
"lint": "semistandard -v $(git ls-files '*.js') | snazzy",
"precommit": "npm run lint"
},
Expand Down
15 changes: 8 additions & 7 deletions src/components/rotation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var coordinateParser = require('./coordinate-parser');
var registerComponent = require('../core/register-component').registerComponent;
var THREE = require('../../lib/three');
var utils = require('../vr-utils');
var THREE = require('../../lib/three');

var proto = {
defaults: {
Expand All @@ -12,16 +12,17 @@ var proto = {
}
},

/**
* Updates object3D rotation.
*/
update: {
value: function () {
var data = this.data;
var object3D = this.el.object3D;
// Updates three.js object
var rotationX = THREE.Math.degToRad(data.x);
var rotationY = THREE.Math.degToRad(data.y);
var rotationZ = THREE.Math.degToRad(data.z);
// Updates three.js object
object3D.rotation.set(rotationX, rotationY, rotationZ);
object3D.rotation.set(THREE.Math.degToRad(data.x),
THREE.Math.degToRad(data.y),
THREE.Math.degToRad(data.z));
object3D.rotation.order = 'YXZ';
}
}
};
Expand Down
5 changes: 5 additions & 0 deletions src/core/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ Component.prototype = {
return utils.mixin({}, data);
},

/**
* Calls style parser on a component string.
*
* @returns {object}
*/
parseAttributesString: function (attrs) {
if (typeof attrs !== 'string') { return attrs; }
// We camel case keys so for instance max-value is equivalent to maxValue
Expand Down
16 changes: 13 additions & 3 deletions src/core/vr-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,14 @@ var proto = {
writable: window.debug
},

/**
* If attribute is a component, it parses the style-like string into an
* object. Returned component data does not include applied mixins or
* defaults.
*
* @param {string} attr
* @returns {object|string} Object if component, else string.
*/
getAttribute: {
value: function (attr) {
var component = VRComponents[attr];
Expand All @@ -298,9 +306,11 @@ var proto = {
},

/**
* Returns the computed attribute from the element itself,
* applied mixins and default values
* @type {string} attr - Atrribute name
* If attribute is a component, it returns component data including applied
* mixins and defaults.
*
* @param {string} attr
* @returns {object|string} Object if component, else string.
*/
getComputedAttribute: {
value: function (attr) {
Expand Down
Loading

0 comments on commit 801bbfc

Please sign in to comment.