diff --git a/README.md b/README.md index 342151ae..1510eeaa 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,7 @@ computeLayout( ]} ``` -To run the tests - -- For the JS tests: Open `RunLayoutTests.html` and `RunLayoutRandomTests.html` in Chrome or run `$ npm test` -- For the C and Java tests: run `make` in your terminal. It will also transpile the JS code +NOTE: You need to run the JavaScript build, as detailed below, before running this code. Supported Attributes -------------------- @@ -81,3 +78,15 @@ div, span { - Everything is `display: flex` by default. All the behaviors of `block` and `inline-block` can be expressed in term of `flex` but not the opposite. - All the flex elements are oriented from top to bottom, left to right and do not shrink. This is how things are laid out using the default CSS settings and what you'd expect. - Everything is `position: relative`. This makes `position: absolute` target the direct parent and not some parent which is either `relative` or `absolute`. If you want to position an element relative to something else, you should move it in the DOM instead of relying of CSS. It also makes `top, left, right, bottom` do something when not specifying `position: absolute`. + +Development +----------- + +The core logic resides with `Layout.js`, which is transpiled into equivalent C and Java implementations. + +To run the tests + +- For the JS tests: run `grunt karma` +- For the C and Java tests: run `make` in your terminal. It will also transpile the JS code. This build is also run via Travis CI. + +The JavaScript build process is managed via Grunt. The build performs linting, runs the tests and produce a minified version of the code within a `dist` folder. The build output uses the Universal Module Format (UMD) so that it can be used via AMD / RequireJS, CommonJS or included directly into an HTML page. diff --git a/RunLayoutRandomTests.html b/RunLayoutRandomTests.html deleted file mode 100644 index 0b99ae5a..00000000 --- a/RunLayoutRandomTests.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - Jasmine Spec Runner v2.0.0 - - - - - - - - - - - - - - - - - diff --git a/RunLayoutTests.html b/RunLayoutTests.html deleted file mode 100644 index ee31c822..00000000 --- a/RunLayoutTests.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - Jasmine Spec Runner v2.0.0 - - - - - - - - - - - - - - - - - - diff --git a/src/Layout.js b/src/Layout.js index 898b3186..4c1ca6f6 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -985,22 +985,3 @@ var computeLayout = (function() { extractNodes: extractNodes }; })(); - -// UMD (Universal Module Definition) -// See https://github.com/umdjs/umd for reference -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define([], factory); - } else if (typeof exports === 'object') { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(); - } else { - // Browser globals (root is window) - root.returnExports = factory(); - } -}(this, function () { - return computeLayout; -})); diff --git a/src/css-layout.js b/src/css-layout.js index 14ebab19..02514160 100644 --- a/src/css-layout.js +++ b/src/css-layout.js @@ -1,5 +1,8 @@ // UMD (Universal Module Definition) // See https://github.com/umdjs/umd for reference +// +// This file uses the following specific UMD implementation: +// https://github.com/umdjs/umd/blob/master/returnExports.js (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module.