@@ -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 ( ) {
@@ -897,6 +897,53 @@ suite('a-entity', function () {
897897 data = el . getAttribute ( 'geometry' ) ;
898898 assert . ok ( el . components . geometry . data === data ) ;
899899 } ) ;
900+
901+ test ( 'returns position previously set with setAttribute' , function ( ) {
902+ var el = this . el ;
903+ el . setAttribute ( 'position' , { x : 1 , y : 2 , z : 3 } ) ;
904+ assert . shallowDeepEqual ( el . getAttribute ( 'position' ) , { x : 1 , y : 2 , z : 3 } ) ;
905+ } ) ;
906+
907+ test ( 'returns position set by modifying the object3D position' , function ( ) {
908+ var el = this . el ;
909+ el . object3D . position . set ( 1 , 2 , 3 ) ;
910+ assert . shallowDeepEqual ( el . getAttribute ( 'position' ) , { x : 1 , y : 2 , z : 3 } ) ;
911+ } ) ;
912+
913+ test ( 'returns rotation previously set with setAttribute' , function ( ) {
914+ var el = this . el ;
915+ el . setAttribute ( 'rotation' , { x : 10 , y : 45 , z : 50 } ) ;
916+ assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 10 , y : 45 , z : 50 } ) ;
917+ } ) ;
918+
919+ test ( 'returns rotation previously set by modifying the object3D rotation' , function ( ) {
920+ var el = this . el ;
921+ el . object3D . rotation . set ( Math . PI , Math . PI / 2 , Math . PI / 4 ) ;
922+ assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 180 , y : 90 , z : 45 } ) ;
923+ } ) ;
924+
925+ test ( 'returns rotation previously set by modifying the object3D quaternion' , function ( ) {
926+ var el = this . el ;
927+ var quaternion = new THREE . Quaternion ( ) ;
928+ var euler = new THREE . Euler ( ) ;
929+ euler . order = 'YXZ' ;
930+ euler . set ( Math . PI / 2 , Math . PI , 0 ) ;
931+ quaternion . setFromEuler ( euler ) ;
932+ el . object3D . quaternion . copy ( quaternion ) ;
933+ assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 90 , y : 180 , z : 0 } ) ;
934+ } ) ;
935+
936+ test ( 'returns scale previously set with setAttribute' , function ( ) {
937+ var el = this . el ;
938+ el . setAttribute ( 'scale' , { x : 1 , y : 2 , z : 3 } ) ;
939+ assert . shallowDeepEqual ( el . getAttribute ( 'scale' ) , { x : 1 , y : 2 , z : 3 } ) ;
940+ } ) ;
941+
942+ test ( 'returns scale set by modifying the object3D scale' , function ( ) {
943+ var el = this . el ;
944+ el . object3D . scale . set ( 1 , 2 , 3 ) ;
945+ assert . shallowDeepEqual ( el . getAttribute ( 'scale' ) , { x : 1 , y : 2 , z : 3 } ) ;
946+ } ) ;
900947 } ) ;
901948
902949 suite ( 'removeAttribute' , function ( ) {
@@ -1312,12 +1359,12 @@ suite('a-entity', function () {
13121359 var el = this . el ;
13131360 mixinFactory ( 'material' , { material : 'shader: flat' } ) ;
13141361 mixinFactory ( 'position' , { position : '1 2 3' } ) ;
1315- mixinFactory ( 'rotation' , { rotation : '10 20 30 ' } ) ;
1362+ mixinFactory ( 'rotation' , { rotation : '10 20 45 ' } ) ;
13161363 el . setAttribute ( 'mixin' , ' material\t\nposition \t rotation\n ' ) ;
13171364 el . setAttribute ( 'material' , 'color: red' ) ;
13181365 assert . shallowDeepEqual ( el . getAttribute ( 'material' ) , { shader : 'flat' , color : 'red' } ) ;
13191366 assert . shallowDeepEqual ( el . getAttribute ( 'position' ) , { x : 1 , y : 2 , z : 3 } ) ;
1320- assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 10 , y : 20 , z : 30 } ) ;
1367+ assert . shallowDeepEqual ( el . getAttribute ( 'rotation' ) , { x : 10 , y : 20 , z : 45 } ) ;
13211368 assert . equal ( el . mixinEls . length , 3 ) ;
13221369 } ) ;
13231370
0 commit comments