Add data-disabled to test fixtures (#1286)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1286

This can be marked in fixtures to skip a test without commenting it out. We add one more usage of this.

The same functionality existed (unused) before for `experiments`, which I changed to `data-experiments`.

Formatting of JS tests changed to be closer to what Prettier would output, and to remove usage of `Yoga.UNDEFINED` which doesn't existi and just resolves to `undefined` (this is converted to NaN by the wrapper layer).

Reviewed By: yungsters

Differential Revision: D45723003

fbshipit-source-id: 337af319ab1c1c12047d6579da8c7e63b4f1537a
This commit is contained in:
Nick Gerleman
2023-05-10 22:46:39 -07:00
committed by Facebook GitHub Bot
parent e409bfb43a
commit e769dd97d8
52 changed files with 1846 additions and 1101 deletions

View File

@@ -33,8 +33,9 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
emitPrologue:{value:function() {}},
emitTestPrologue:{value:function(name, experiments) {
this.push('test(' + JSON.stringify(name) + ', () => {');
emitTestPrologue:{value:function(name, experiments, ignore) {
const testFn = ignore ? `test.skip` : 'test';
this.push(`${testFn}('${name}', () => {`);
this.pushIndent();
this.push('const config = Yoga.Config.create();');
this.push('let root;');
@@ -64,7 +65,7 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
this.push('} finally {');
this.pushIndent();
this.push('if (typeof root !== "undefined") {');
this.push('if (typeof root !== \'undefined\') {');
this.pushIndent();
this.push('root.freeRecursive();');
this.popIndent();
@@ -135,13 +136,13 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
YGWrapWrap:{value:'Yoga.WRAP_WRAP'},
YGWrapWrapReverse:{value: 'Yoga.WRAP_WRAP_REVERSE'},
YGUndefined:{value:'Yoga.UNDEFINED'},
YGUndefined:{value:'undefined'},
YGDisplayFlex:{value:'Yoga.DISPLAY_FLEX'},
YGDisplayNone:{value:'Yoga.DISPLAY_NONE'},
YGNodeCalculateLayout:{value:function(node, dir, experiments) {
this.push(node + '.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, ' + dir + ');');
this.push(node + '.calculateLayout(undefined, undefined, ' + dir + ');');
}},
YGNodeInsertChild:{value:function(parentName, nodeName, index) {