Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3456 from jasonLaster/7-25
Browse files Browse the repository at this point in the history
New Release
  • Loading branch information
jasonLaster authored Jul 27, 2017
2 parents e421d1f + f72587e commit f13e627
Show file tree
Hide file tree
Showing 20 changed files with 3,973 additions and 646 deletions.
2,688 changes: 2,688 additions & 0 deletions assets/module-manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/panel/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pref("devtools.debugger.auto-black-box", true);
pref("devtools.debugger.workers", false);

// The default Debugger UI settings
pref("devtools.debugger.prefs-schema-version", "1.0.0");
pref("devtools.debugger.prefs-schema-version", "1.0.2");
pref("devtools.debugger.ui.panes-workers-and-sources-width", 200);
pref("devtools.debugger.ui.panes-instruments-width", 300);
pref("devtools.debugger.ui.panes-visible-on-startup", false);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"devtools-components": "^0.0.1",
"devtools-launchpad": "0.0.88",
"devtools-reps": "^0.9.0",
"devtools-source-editor": "0.0.5",
"devtools-source-editor": "0.0.6",
"devtools-source-map": "0.8.0",
"devtools-splitter": "^0.0.3",
"fuzzaldrin-plus": "^0.4.1",
Expand Down
22 changes: 8 additions & 14 deletions src/components/Editor/Breakpoints.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import { Component, createFactory, DOM as dom } from "react";
import { isEnabled } from "devtools-config";

import _Breakpoint from "./Breakpoint";
const Breakpoint = createFactory(_Breakpoint);
Expand Down Expand Up @@ -39,19 +38,14 @@ class Breakpoints extends Component {

return dom.div(
{},
breakpoints
.valueSeq()
.filter(
b => (isEnabled("columnBreakpoints") ? !b.location.column : true)
)
.map(bp =>
Breakpoint({
key: makeLocationId(bp.location),
breakpoint: bp,
selectedSource,
editor: editor
})
)
breakpoints.valueSeq().map(bp =>
Breakpoint({
key: makeLocationId(bp.location),
breakpoint: bp,
selectedSource,
editor: editor
})
)
);
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/components/Editor/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,13 @@ class SearchBar extends Component {
async searchContents(query: string) {
const { selectedSource, modifiers, editor: ed } = this.props;

if (!ed || !selectedSource || !selectedSource.get("text") || !modifiers) {
if (
!query ||
!ed ||
!selectedSource ||
!selectedSource.get("text") ||
!modifiers
) {
return;
}

Expand Down
8 changes: 6 additions & 2 deletions src/components/Editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class Editor extends PureComponent {
this.cbPanel = null;
const editor = this.setupEditor();

const { selectedSource } = this.props;
const { selectedSource, selectedLocation } = this.props;
const { shortcuts } = this.context;

const searchAgainKey = L10N.getStr("sourceSearch.search.again.key2");
Expand All @@ -221,6 +221,10 @@ class Editor extends PureComponent {
shortcuts.on(searchAgainPrevKey, this.onSearchAgain);
shortcuts.on(searchAgainKey, this.onSearchAgain);

if (selectedLocation && !!selectedLocation.line) {
this.pendingJumpLine = selectedLocation.line;
}

updateDocument(editor, selectedSource);
}

Expand Down Expand Up @@ -562,7 +566,7 @@ class Editor extends PureComponent {
renderHighlightLines() {
const { highlightedLineRange } = this.props;

if (!highlightedLineRange) {
if (!highlightedLineRange || !this.state.editor) {
return;
}

Expand Down
47 changes: 47 additions & 0 deletions src/components/Editor/tests/Breakpoints.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";
import { shallow } from "enzyme";
import Breakpoints from "../Breakpoints";
import * as I from "immutable";

const BreakpointsComponent = React.createFactory(Breakpoints.WrappedComponent);

function generateDefaults(overrides) {
const sourceId = "server1.conn1.child1/source1";
const matchingBreakpoints = { id1: { location: { sourceId } } };

return {
selectedSource: { sourceId, get: () => false },
editor: {
codeMirror: {
setGutterMarker: jest.fn()
}
},
breakpoints: I.Map(matchingBreakpoints),
...overrides
};
}

function render(overrides = {}) {
const props = generateDefaults(overrides);
const component = shallow(new BreakpointsComponent(props));
return { component, props };
}

describe("Breakpoints Component", () => {
it("should render breakpoints without columns", async () => {
const sourceId = "server1.conn1.child1/source1";
const breakpoints = I.Map({ id1: { location: { sourceId } } });

const { component, props } = render({ breakpoints });
expect(component.find("Breakpoint").length).toBe(props.breakpoints.size);
});

it("should render breakpoints with columns", async () => {
const sourceId = "server1.conn1.child1/source1";
const breakpoints = I.Map({ id1: { location: { column: 2, sourceId } } });

const { component, props } = render({ breakpoints });
expect(component.find("Breakpoint").length).toBe(props.breakpoints.size);
expect(component).toMatchSnapshot();
});
});
33 changes: 32 additions & 1 deletion src/components/Editor/tests/SearchBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { createFactory } from "react";
import { shallow } from "enzyme";
import SearchBar from "../SearchBar";
import "../../../utils/search";
import "../../../utils/editor";

jest.mock("../../../utils/search", () => ({
getMatches: () => Promise.resolve(["result"])
}));

jest.mock("../../../utils/editor", () => ({
find: () => ({ ch: "1", line: "1" })
}));

const SearchBarComponent = createFactory(SearchBar.WrappedComponent);

Expand All @@ -9,10 +19,20 @@ function generateDefaults() {
query: "",
searchOn: true,
symbolSearchOn: true,
editor: {},
searchResults: {},
selectedSymbolType: "functions",
selectedSource: {
get: () => " text text query text"
},
setFileSearchQuery: msg => msg,
symbolSearchResults: [],
selectedResultIndex: 0
modifiers: {
get: jest.fn(),
toJS: () => ({ caseSensitive: true, wholeWord: false, regexMatch: false })
},
selectedResultIndex: 0,
updateSearchResults: jest.fn()
};
}

Expand All @@ -29,3 +49,14 @@ describe("SearchBar", () => {
expect(component).toMatchSnapshot();
});
});

describe("doSearch", () => {
it("should complete a search", async () => {
const { component, props } = render();
await component
.find("SearchInput")
.simulate("change", { target: { value: "query" } });
const updateSearchArgs = props.updateSearchResults.mock.calls[0][0];
expect(updateSearchArgs).toMatchSnapshot();
});
});
Loading

0 comments on commit f13e627

Please sign in to comment.