Merge branch 'master' into visualizeTestChange

This commit is contained in:
LeeDr 2016-03-18 11:12:11 -05:00
commit e39c0f8f83
7 changed files with 60 additions and 9 deletions

View file

@ -55,7 +55,7 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
npm run elasticsearch
```
- Start the development server.
- Start the development server. _On Windows, you'll need you use Git Bash, Cygwin, or a similar shell that exposes the `sh` command._
```sh
npm start
@ -146,7 +146,8 @@ Run the tests for just your particular plugin. Assuming you plugin lives outside
#### Running browser automation tests:
*The Selenium server that is started currently only runs the tests in Firefox*
*The Selenium server that is started currently only runs the tests in a recent version of Firefox.*
*You can use the `PATH` environment variable to specify which version of Firefox to use.*
The following will start Kibana, Elasticsearch and Selenium for you. To run the functional UI tests use the following commands
@ -177,7 +178,7 @@ npm run test:ui:runner
- These tests have been developed and tested with Chrome and Firefox browser. In theory, they should work on all browsers (that's the benefit of Intern using Leadfoot).
- These tests should also work with an external testing service like https://saucelabs.com/ or https://www.browserstack.com/ but that has not been tested.
- https://theintern.github.io/
- https://theintern.github.io/leadfoot/Element.html
- https://theintern.github.io/leadfoot/module-leadfoot_Element.html
#### Building OS packages

View file

@ -49,7 +49,7 @@
"test:coverage": "grunt test:coverage",
"build": "grunt build",
"build:ospackages": "grunt build --os-packages",
"start": "./bin/kibana --dev",
"start": "sh ./bin/kibana --dev",
"precommit": "grunt precommit",
"karma": "karma start",
"elasticsearch": "grunt esvm:dev:keepalive",

View file

@ -48,7 +48,14 @@ module.exports = function (path) {
_.forOwn(val, function (subVal, subKey) {
apply(config, subVal, key + '.' + subKey);
});
} else {
}
else if (_.isArray(val)) {
config[key] = [];
val.forEach((subVal, i) => {
apply(config, subVal, key + '.' + i);
});
}
else {
_.set(config, key, val);
}
}

View file

@ -4,7 +4,6 @@ import Status from '../status';
import ServerStatus from '../server_status';
describe('Status class', function () {
var server;
var serverStatus;
@ -59,6 +58,34 @@ describe('Status class', function () {
expect(json.message).to.eql('Ready');
});
it('should call on handler if status is already matched', function (done) {
var status = serverStatus.create('test');
var msg = 'Test Ready';
status.green(msg);
status.on('green', function (prev, prevMsg) {
expect(arguments.length).to.equal(2);
expect(prev).to.be('green');
expect(prevMsg).to.be(msg);
expect(status.message).to.equal(msg);
done();
});
});
it('should call once handler if status is already matched', function (done) {
var status = serverStatus.create('test');
var msg = 'Test Ready';
status.green(msg);
status.once('green', function (prev, prevMsg) {
expect(arguments.length).to.equal(2);
expect(prev).to.be('green');
expect(prevMsg).to.be(msg);
expect(status.message).to.equal(msg);
done();
});
});
function testState(color) {
it(`should change the state to ${color} when #${color}() is called`, function () {
var status = serverStatus.create('test');

View file

@ -36,6 +36,22 @@ class Status extends EventEmitter {
since: this.since
};
}
on(eventName, handler) {
super.on(eventName, handler);
if (eventName === this.state) {
setImmediate(() => handler(this.state, this.message));
}
}
once(eventName, handler) {
if (eventName === this.state) {
setImmediate(() => handler(this.state, this.message));
} else {
super.once(eventName, handler);
}
}
}
states.all.forEach(function (state) {

View file

@ -43,8 +43,8 @@ describe('Notifier', function () {
expect(notify('error').title).to.equal('Error');
});
it('sets lifetime to Infinity', function () {
expect(notify('error').lifetime).to.equal(Infinity);
it('sets lifetime to 5 minutes', function () {
expect(notify('error').lifetime).to.equal(300000);
});
it('allows reporting', function () {

View file

@ -229,7 +229,7 @@ Notifier.prototype.error = function (err, cb) {
content: formatMsg(err, this.from),
icon: 'warning',
title: 'Error',
lifetime: Infinity,
lifetime: 300000,
actions: ['report', 'accept'],
stack: formatStack(err)
}, cb);