Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderGugel committed Jun 19, 2015
1 parent 1d7e58b commit 575a3f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 113 deletions.
2 changes: 2 additions & 0 deletions dom-renderables/DOMElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ DOMElement.Spec = function Spec(options) {
this.properties = options.properties || {};
this.content = options.content || '';
this.cutout = options.cutout != null ? options.cutout : true;
this.allowDefault = options.allowDefault || {};
this.preventDefault = options.preventDefault || {};

this.classes['famous-dom-element'] = true;

Expand Down
113 changes: 0 additions & 113 deletions dom-renderables/test/DOMElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ function createMockNode() {
};
}

<<<<<<< HEAD
test('DOMElement', function(t) {
t.test('constructor (default options)', function(t) {
t.equal(typeof DOMElement, 'function', 'DOMElement should be a constructor function');

=======
function createMountedDOMElement() {
var node = createMockNode();
var domElement = new DOMElement(node);
Expand Down Expand Up @@ -241,7 +235,6 @@ test('DOMElement', function(t) {

t.equal(typeof domElement.onDismount, 'function', 'DOMElement#onDismount should be a function');

>>>>>>> fix: Refactor DOMElement
t.end();
});

Expand All @@ -260,30 +253,6 @@ test('DOMElement', function(t) {
);

t.end();
<<<<<<< HEAD
});

t.test('should get initial spec from node', function(t) {
/*
var node = createMockNode(t);
node.sentDrawCommands = ['EXISTING', 'DRAW', 'COMMANDS'];
node.shown = false;
node.location = 'body/4/45/4/5';
node.transform = [
0.5, 0, 0, 0,
0, 0.5, 0, 0,
0, 0, 0.5, 0,
0, 0, 0, 0.5
];
node.size = [100, 200, 300];
node.sizeMode = [1, 1, 1];
node.uiEvents = [];
node.opacity = 0.4;
var domElement = new DOMElement(node);
domElement.onMount(node, 3);
=======
});

t.test('onHide method', function(t) {
Expand Down Expand Up @@ -334,7 +303,6 @@ test('DOMElement', function(t) {
t.equal(typeof domElement.onTransformChange, 'function', 'DOMElement#onTransformChange should be a function');

domElement.onTransformChange([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
>>>>>>> fix: Refactor DOMElement

t.deepEqual(
domElement._node.sentDrawCommands,
Expand All @@ -357,15 +325,9 @@ test('DOMElement', function(t) {
domElement.onUpdate();

t.deepEqual(
<<<<<<< HEAD
node.sentDrawCommands,
'should send initial styles on first update. Should take into ' +
'account size, UI Events etc. from Node'
=======
domElement._node.sentDrawCommands,
[ 'WITH', 'body/0', 'CHANGE_SIZE', false, 200 ],
'DOMElement#onSizeChange should send false as size if render sized'
>>>>>>> fix: Refactor DOMElement
);

t.end();
Expand All @@ -384,27 +346,14 @@ test('DOMElement', function(t) {
[ 'WITH', 'body/0', 'CHANGE_PROPERTY', 'opacity', 0.5 ],
'DOMElement#onOpacityChange should send correct draw commands'
);
<<<<<<< HEAD
*/
=======
>>>>>>> fix: Refactor DOMElement

t.end();
});

<<<<<<< HEAD
t.test('onMount, onUpdate, onDismount lifecyle', function(t) {
// t.plan(12);

/*
var node = createMockNode(t);
var domElement = new DOMElement(node);
=======
t.test('onAddUIEvent method', function(t) {
var domElement = createMountedDOMElement();

t.equal(typeof domElement.onAddUIEvent, 'function', 'DOMElement#onAddUIEvent should be a function');
>>>>>>> fix: Refactor DOMElement

domElement.onAddUIEvent('click');
domElement.onUpdate();
Expand Down Expand Up @@ -548,29 +497,6 @@ test('DOMElement', function(t) {
);

node.sentDrawCommands.length = 0;
<<<<<<< HEAD
domElement.onUpdate();
t.deepEqual(
node.sentDrawCommands,
[ 'WITH', 'body/3', 'DOM', 'CHANGE_SIZE', 0, 0, 'CHANGE_PROPERTY', 'display', true, 'CHANGE_PROPERTY', 'opacity', 1, 'CHANGE_PROPERTY', 'position', 'absolute', 'CHANGE_PROPERTY', '-webkit-transform-origin', '0% 0%', 'CHANGE_PROPERTY', 'transform-origin', '0% 0%', 'CHANGE_PROPERTY', '-webkit-backface-visibility', 'visible', 'CHANGE_PROPERTY', 'backface-visibility', 'visible', 'CHANGE_PROPERTY', '-webkit-transform-style', 'preserve-3d', 'CHANGE_PROPERTY', 'transform-style', 'preserve-3d', 'CHANGE_PROPERTY', '-webkit-tap-highlight-color', 'transparent', 'CHANGE_PROPERTY', 'pointer-events', 'auto', 'CHANGE_PROPERTY', 'z-index', '1', 'CHANGE_PROPERTY', 'box-sizing', 'border-box', 'CHANGE_PROPERTY', '-moz-box-sizing', 'border-box', 'CHANGE_PROPERTY', '-webkit-box-sizing', 'border-box', 'CHANGE_ATTRIBUTE', 'data-fa-path', 'body/0' ],
'should send initial styles on first update'
);
node.sentDrawCommands.length = 0;
domElement.onUpdate();
t.deepEqual(
node.sentDrawCommands,
[ 'WITH', 'body/0', 'CHANGE_ATTRIBUTE', 'data-fa-path', '', 'GL_CUTOUT_STATE', false],
'Dismounting the node should result into the DOMElement being ' +
'hidden'
);
*/
t.end();
});

t.test('on, onReceive method', function(t) {
var node = createMockNode(t);
var domElement = new DOMElement(node);
=======

domElement.addClass('class-2');
domElement.onUpdate();
Expand All @@ -588,7 +514,6 @@ test('DOMElement', function(t) {
var domElement = createMountedDOMElement();

t.equal(typeof domElement.removeClass, 'function', 'DOMElement#removeClass should be a function');
>>>>>>> fix: Refactor DOMElement

domElement.removeClass('not-added');
domElement.onUpdate();
Expand Down Expand Up @@ -630,43 +555,6 @@ test('DOMElement', function(t) {

t.equal(typeof domElement.getClasses, 'function', 'DOMElement#getClasses should be a function');

<<<<<<< HEAD
domElement.onReceive('some event', actualEvent);
t.end();
});

t.test('setContent method', function(t) {
var node = createMockNode(t);
var domElement = new DOMElement(node);
t.equal(
typeof domElement.setContent,
'function',
'domElement.setContent should be a function'
);

// domElement.onMount(node, 0);
t.doesNotThrow(function() {
domElement.setContent('some content');
}, 'should not error when passed a String');

t.end();
});

t.test('setProperty method', function (t) {
var node = createMockNode(t);
var domElement = new DOMElement(node);
t.equal(
typeof domElement.setProperty,
'function',
'domElement.setProperty should be a function'
);

t.doesNotThrow(function() {
domElement.setProperty('background', 'red');
}, 'should not fail when passed a key value pair');

t.end();
=======
t.deepEqual(domElement.getClasses(), ['famous-dom-element'], 'DOMElement#getClasses should have a famous-dom-element class in it');

domElement.addClass('class-1');
Expand Down Expand Up @@ -826,6 +714,5 @@ test('DOMElement', function(t) {
domElement.onReceive('resize', resizePayload);

t.deepEqual(domElement.getValue().renderSize, [100, 200]);
>>>>>>> fix: Refactor DOMElement
});
});

0 comments on commit 575a3f1

Please sign in to comment.