forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1289258 - Part 2 - Add mocha test for search. r=bgrins
MozReview-Commit-ID: RoAVWKb0qC
- Loading branch information
Showing
16 changed files
with
124 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
devtools/client/webconsole/new-console-output/test/fixtures/Services.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
module.exports = { | ||
prefs: { | ||
getIntPref: pref => { | ||
switch (pref) { | ||
case "devtools.hud.loglimit": | ||
return 1000; | ||
} | ||
}, | ||
getBoolPref: pref => { | ||
switch (pref) { | ||
default: | ||
return true; | ||
} | ||
} | ||
} | ||
}; |
8 changes: 8 additions & 0 deletions
8
devtools/client/webconsole/new-console-output/test/fixtures/moz.build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# vim: set filetype=python: | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
DevToolsModules( | ||
'stubs.js', | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
devtools/client/webconsole/new-console-output/test/store/filters.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
const expect = require("expect"); | ||
|
||
const actions = require("devtools/client/webconsole/new-console-output/actions/messages"); | ||
const { getAllMessages } = require("devtools/client/webconsole/new-console-output/selectors/messages"); | ||
const { configureStore } = require("devtools/client/webconsole/new-console-output/store"); | ||
const { stubConsoleMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs"); | ||
const Services = require("devtools/client/webconsole/new-console-output/test/fixtures/Services"); | ||
|
||
describe("Search", () => { | ||
it("matches on value grips", () => { | ||
const store = setupStore([ | ||
"console.log('foobar', 'test')", | ||
"console.warn('danger, will robinson!')", | ||
"console.log(undefined)" | ||
]); | ||
store.dispatch(actions.messagesSearch("danger")); | ||
|
||
let messages = getAllMessages(store.getState()); | ||
expect(messages.size).toEqual(1); | ||
}); | ||
}); | ||
|
||
function setupStore(input) { | ||
const store = configureStore(Services); | ||
addMessages(input, store.dispatch); | ||
return store; | ||
} | ||
|
||
function addMessages(input, dispatch) { | ||
input.forEach((cmd) => { | ||
dispatch(actions.messageAdd(stubConsoleMessages.get(cmd))); | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "webconsole", | ||
"version": "0.0.1", | ||
"devDependencies": { | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-register": "^6.7.2", | ||
"expect": "^1.16.0", | ||
"mocha": "^2.5.3" | ||
}, | ||
"scripts": { | ||
"test": "NODE_PATH=`pwd`/../../../ mocha new-console-output/test/**/*.test.js --compilers js:babel-register" | ||
} | ||
} |