Skip to content

Commit

Permalink
chore - doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rayshan committed Feb 25, 2015
1 parent 8815c2d commit fe9c810
Show file tree
Hide file tree
Showing 249 changed files with 8,027 additions and 7,701 deletions.
43 changes: 27 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,27 @@ Contributing

Pull requests are gladly accepted. We also really appreciate tests.

Tests
-----

Tests can be run by loading the following url in your browser `/test/run.html`.
## Running Tests

Tests can be run by loading the following url in your browser `/test/run.html`

E.g. of running an individual test: `/test/run.html?spec=events/eventmanager-spec`


### Creating


#### Unit test

Here's how to create a new unit test:

1. run `minit create:spec -n myspec`. This will create a `-spec.js` file where you can add your Jasmine assertions.
2. Add the moduleId of the new spec to `/test/run.js`.


#### UI test

Here's how to create a new ui test:

1. run `minit create:test -n mytest`. This will create a `mytest` directory that includes
Expand All @@ -31,25 +38,25 @@ The spec file queues up the ui test and executes the assertions when the page u
```javascript
var TestPageLoader = require("montage-testing/testpageloader").TestPageLoader;

TestPageLoader.queueTest("mytest", function(testPage) {
describe("test/ui/mytest-spec", function() {
TestPageLoader.queueTest("mytest", function (testPage) {
describe("test/ui/mytest-spec", function () {
...
})
});
```

Core Team
=========

git subtree
-----------
## Notes for Core Team


### git subtree

Git subtrees are like submodules, but better and easier for everyone involved. They allow you to import code from a different repository but instead of adding a *reference* to your repository, they add the **actual code** *and commit saying where the code came from*.

The great thing about subtrees is if you do not care about merging or splitting them, they **do not affect you**. You can treat the whole repository as you would normally. If the above describes you, you can stop reading now.

Installing
----------

#### Installing

If you use OSX and homebrew, then `brew install git` will install the subtree command along with git.

Expand All @@ -60,34 +67,38 @@ Otherwise it is a single script you can download:
3. Rename to git-subtree: `mv git-subtree.sh git-subtree`
4. Move to a directory on your `PATH`

Using
-----

#### Using

Each section below has a description and example for each command, and a list of the subtrees in each of the montagejs
repositories with the command that you can copy and paste. See the Adding section for an example of what a subtree looks
like.

### Merging/pulling

#### Merging/pulling

This will merge updates from the other repository while keeping any changes made to the subtree locally (for example deleted files).

```bash
git subtree pull --squash --prefix=$dir$ [email protected]:$repo$.git $commitOrTag$ -m "Update $name$ to $version$"
```


#### Mr ↣ Montage

```bash
git subtree pull --squash --prefix=packages/mr [email protected]:montagejs/mr.git $version -m "Update Mr to $version$"
```


### Splitting
#### Splitting

Splitting allows you take take changes to the subtree from your repository and commit them to the other one.

TODO: Write after splitting for the first time

### Adding

#### Adding

This will add all the files in `repo` at `commit` under `dir`, and will create 2 commits

Expand Down
30 changes: 15 additions & 15 deletions composer/composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
* @default null
*/
component: {
get: function() {
get: function () {
return this._component;
},
set: function(component) {
set: function (component) {
this._component = component;
}
},
Expand All @@ -62,10 +62,10 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
* @default null
*/
element: {
get: function() {
get: function () {
return this._element;
},
set: function(element) {
set: function (element) {
this._element = element;
}
},
Expand Down Expand Up @@ -100,7 +100,7 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
* @default false
*/
needsFrame: {
set: function(value) {
set: function (value) {
if (this._needsFrame !== value) {
this._needsFrame = value;
if (this._component) {
Expand All @@ -110,7 +110,7 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
}
}
},
get: function() {
get: function () {
return this._needsFrame;
}
},
Expand All @@ -119,11 +119,11 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
* This method will be invoked by the framework at the beginning of a draw
* cycle. This is where a composer may implement its update logic if it
* needs to respond to draws by its component.
* @method
* @function
* @param {Date} timestamp The time that the draw cycle started
*/
frame: {
value: function(timestamp) {
value: function (timestamp) {

}
},
Expand All @@ -135,7 +135,7 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
* @private
*/
_resolveDefaults: {
value: function() {
value: function () {
if (this.element == null && this.component != null) {
this.element = this.component.element;
}
Expand All @@ -147,7 +147,7 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
* @private
*/
_load: {
value: function() {
value: function () {
if (!this.element) {
this._resolveDefaults();
}
Expand All @@ -163,10 +163,10 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
* Subclasses should override `load` with their DOM initialization. Most
* composers attach DOM event listeners to `this.element` in `load`.
*
* @method
* @function
*/
load: {
value: function() {
value: function () {

}
},
Expand All @@ -178,10 +178,10 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
* Subclasses should override `unload` to do any necessary cleanup, such as
* removing event listeners.
*
* @method
* @function
*/
unload: {
value: function() {
value: function () {

}
},
Expand All @@ -192,7 +192,7 @@ exports.Composer = Target.specialize( /** @lends Composer# */ {
* @private
*/
deserializedFromTemplate: {
value: function() {
value: function () {
if (this.component) {
this.component.addComposer(this);
}
Expand Down
40 changes: 20 additions & 20 deletions composer/key-composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ var KeyComposer = exports.KeyComposer = Composer.specialize( /** @lends KeyCompo
* @default null
*/
keys: {
get: function() {
get: function () {
return this._keys;
},
set: function(keys) {
set: function (keys) {
if (this._keyRegistered) {
KeyManagerProxy.defaultKeyManager.unregisterKey(this);
this._keys = keys;
Expand All @@ -75,7 +75,7 @@ var KeyComposer = exports.KeyComposer = Composer.specialize( /** @lends KeyCompo
},

load: {
value: function() {
value: function () {
// Only register the key if somebody is listening for, else let do
// it later.
// console.log("--- load", this.identifier);
Expand All @@ -88,7 +88,7 @@ var KeyComposer = exports.KeyComposer = Composer.specialize( /** @lends KeyCompo
},

unload: {
value: function() {
value: function () {
this._isLoaded = false;
KeyManagerProxy.defaultKeyManager.unregisterKey(this);
this._keyRegistered = false;
Expand All @@ -97,7 +97,7 @@ var KeyComposer = exports.KeyComposer = Composer.specialize( /** @lends KeyCompo

/**
* Listen to find out when this `KeyComposer` detects a matching key press.
* @method
* @function
* @param {string} type Any of the following types: keyPress, longKeyPress
* and keyRelease.
* @param {Object|function} listener The listener object or function to
Expand All @@ -106,7 +106,7 @@ var KeyComposer = exports.KeyComposer = Composer.specialize( /** @lends KeyCompo
* during the capture phase of the event.
*/
addEventListener: {
value: function(type, listener, useCapture) {
value: function (type, listener, useCapture) {
// Optimisation so that we don't dispatch an event if we do not need to
// console.log("--- addEventListener", this.identifier);
var component = this.component;
Expand Down Expand Up @@ -139,7 +139,7 @@ var KeyComposer = exports.KeyComposer = Composer.specialize( /** @lends KeyCompo
},

constructor: {
value: function() {
value: function () {
// console.log("KEY CREATED")
Composer.constructor.call(this);
}
Expand All @@ -152,7 +152,7 @@ var KeyComposer = exports.KeyComposer = Composer.specialize( /** @lends KeyCompo
* @private
*/
deserializedFromTemplate: {
value: function() {
value: function () {
var component = this.component;

if (this.identifier === null) {
Expand Down Expand Up @@ -193,7 +193,7 @@ var KeyComposer = exports.KeyComposer = Composer.specialize( /** @lends KeyCompo
* @returns {Object} the newly created `KeyComposer` Object
*/
createKey: {
value: function(component, keys, identifier) {
value: function (component, keys, identifier) {
var key = this;

if (this === KeyComposer) {
Expand Down Expand Up @@ -226,14 +226,14 @@ var KeyComposer = exports.KeyComposer = Composer.specialize( /** @lends KeyCompo
*
* The composer will respond to key events that bubble up to the `window`.
*
* @method
* @function
* @param {Object} component. The component to attach the keyComposer to.
* @param {Object} keys. The key sequence.
* @param {Object} identifier. The identifier.
* @returns {Object} the newly created KeyComposer Object
*/
createGlobalKey: {
value: function(component, keys, identifier) {
value: function (component, keys, identifier) {
var key = this;

if (this === KeyComposer) {
Expand Down Expand Up @@ -290,18 +290,18 @@ var KeyManagerProxy = Montage.specialize( {
* @private
*/
constructor: {
value: function() {
value: function () {
// console.log("PROXY CREATED")
}
},

/**
* Register a `KeyComposer` with the default `KeyManager`.
* @method
* @function
* @param {Object} keyComposer. A key composer object.
*/
registerKey: {
value: function(keyComposer) {
value: function (keyComposer) {
var thisRef = this;

if (!this._defaultKeyManager) {
Expand All @@ -310,9 +310,9 @@ var KeyManagerProxy = Montage.specialize( {
this._loadingDefaultKeyManager = true;

require.async("core/event/key-manager")
.then(function(module) {
.then(function (module) {
var keyManager = thisRef._defaultKeyManager = module.defaultKeyManager;
thisRef._keysToRegister.forEach(function(keyComposer) {
thisRef._keysToRegister.forEach(function (keyComposer) {
keyManager.registerKey(keyComposer);
});
thisRef._keysToRegister.length = 0;
Expand All @@ -329,11 +329,11 @@ var KeyManagerProxy = Montage.specialize( {

/**
* Unregister a `KeyComposer` with the default `KeyManager`.
* @method
* @function
* @param {Object} keyComposer. A key composer object.
*/
unregisterKey: {
value: function(keyComposer) {
value: function (keyComposer) {
if (this._defaultKeyManager) {
this._defaultKeyManager.unregisterKey(keyComposer);
}
Expand All @@ -344,11 +344,11 @@ var KeyManagerProxy = Montage.specialize( {

/**
* Return either the default `KeyManager` or its `KeyManagerProxy`.
* @method
* @function
* @returns {Object} `KeyManager` or `KeyManagerProxy`.
*/
defaultKeyManager: {
get: function() {
get: function () {
if (!_keyManagerProxy) {
_keyManagerProxy = new KeyManagerProxy();
}
Expand Down
Loading

0 comments on commit fe9c810

Please sign in to comment.