@@ -347,10 +347,10 @@ suite('a-entity', function () {
347347 test ( 'can update component data' , function ( ) {
348348 var el = this . el ;
349349 el . setAttribute ( 'position' , '10 20 30' ) ;
350- assert . deepEqual ( el . getAttribute ( 'position' ) , { x : 10 , y : 20 , z : 30 } ) ;
350+ assert . shallowDeepEqual ( el . getAttribute ( 'position' ) , { x : 10 , y : 20 , z : 30 } ) ;
351351
352352 el . setAttribute ( 'position' , { x : 30 , y : 20 , z : 10 } ) ;
353- assert . deepEqual ( el . getAttribute ( 'position' ) , { x : 30 , y : 20 , z : 10 } ) ;
353+ assert . shallowDeepEqual ( el . getAttribute ( 'position' ) , { x : 30 , y : 20 , z : 10 } ) ;
354354 } ) ;
355355
356356 test ( 'can partially update multiple properties of a component' , function ( ) {
@@ -392,7 +392,7 @@ suite('a-entity', function () {
392392 test ( 'can partially update vec3' , function ( ) {
393393 var el = this . el ;
394394 el . setAttribute ( 'position' , { y : 20 } ) ;
395- assert . deepEqual ( el . getAttribute ( 'position' ) , { x : 0 , y : 20 , z : 0 } ) ;
395+ assert . shallowDeepEqual ( el . getAttribute ( 'position' ) , { x : 0 , y : 20 , z : 0 } ) ;
396396 } ) ;
397397
398398 test ( 'can update component property with asymmetrical property type' , function ( ) {
@@ -1312,12 +1312,12 @@ suite('a-entity', function () {
13121312 var el = this . el ;
13131313 mixinFactory ( 'material' , { material : 'shader: flat' } ) ;
13141314 mixinFactory ( 'position' , { position : '1 2 3' } ) ;
1315- mixinFactory ( 'rotation' , { rotation : '10 20 30 ' } ) ;
1315+ mixinFactory ( 'rotation' , { rotation : '10 20 45 ' } ) ;
13161316 el . setAttribute ( 'mixin' , ' material\t\nposition \t rotation\n ' ) ;
13171317 el . setAttribute ( 'material' , 'color: red' ) ;
13181318 assert . shallowDeepEqual ( el . getAttribute ( 'material' ) , { shader : 'flat' , color : 'red' } ) ;
13191319 assert . shallowDeepEqual ( el . getAttribute ( 'position' ) , { x : 1 , y : 2 , z : 3 } ) ;
1320- assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 10 , y : 20 , z : 30 } ) ;
1320+ assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 10 , y : 20 , z : 45 } ) ;
13211321 assert . equal ( el . mixinEls . length , 3 ) ;
13221322 } ) ;
13231323
@@ -1336,6 +1336,31 @@ suite('a-entity', function () {
13361336 assert . equal ( el . mixinEls . length , 0 ) ;
13371337 } ) ;
13381338 } ) ;
1339+
1340+ suite ( 'getRotation' , function ( ) {
1341+ test ( 'returns rotation previously set with setAttribute' , function ( ) {
1342+ var el = this . el ;
1343+ el . setAttribute ( 'rotation' , { x : 10 , y : 45 , z : 50 } ) ;
1344+ assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 10 , y : 45 , z : 50 } ) ;
1345+ } ) ;
1346+
1347+ test ( 'returns rotation previously set by modifying the object3D rotation' , function ( ) {
1348+ var el = this . el ;
1349+ el . object3D . rotation . set ( Math . PI , Math . PI / 2 , Math . PI / 4 ) ;
1350+ assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 180 , y : 90 , z : 45 } ) ;
1351+ } ) ;
1352+
1353+ test ( 'returns rotation previously set by modifying the object3D quaternion' , function ( ) {
1354+ var el = this . el ;
1355+ var quaternion = new THREE . Quaternion ( ) ;
1356+ var euler = new THREE . Euler ( ) ;
1357+ euler . order = 'YXZ' ;
1358+ euler . set ( Math . PI / 2 , Math . PI , 0 ) ;
1359+ quaternion . setFromEuler ( euler ) ;
1360+ el . object3D . quaternion . copy ( quaternion ) ;
1361+ assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 90 , y : 180 , z : 0 } ) ;
1362+ } ) ;
1363+ } ) ;
13391364} ) ;
13401365
13411366suite ( 'a-entity component lifecycle management' , function ( ) {
0 commit comments