Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed search highlighting. was only showing highlighted text w/o context #132650

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,19 @@ describe('ProcessTreeNode component', () => {
describe('Search', () => {
it('highlights text within the process node line item if it matches the searchQuery', () => {
// set a mock search matched indicator for the process (typically done by ProcessTree/helpers.ts)
processMock.searchMatched = '/vagrant';
processMock.searchMatched = '/vagr';

renderResult = mockedContext.render(<ProcessTreeNode {...props} />);

expect(
renderResult.getByTestId('sessionView:processNodeSearchHighlight').textContent
).toEqual('/vagrant');
).toEqual('/vagr');

// ensures we are showing the rest of the info, and not replacing it with just the match.
const { process } = props.process.getDetails();
expect(renderResult.container.textContent).toContain(
process?.working_directory + '\xA0' + (process?.args && process.args.join(' '))
);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export function ProcessTreeNode({
});

// eslint-disable-next-line no-unsanitized/property
textRef.current.innerHTML = html;
textRef.current.innerHTML = '<span>' + html + '</span>';
}
}
}, [searchMatched, styles.searchHighlight]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export const useStyles = ({
fontSize: FONT_SIZE,
lineHeight: LINE_HEIGHT,
verticalAlign: 'middle',
display: 'inline-block',
},
};

Expand Down Expand Up @@ -165,6 +164,7 @@ export const useStyles = ({
paddingLeft: size.xxl,
position: 'relative',
lineHeight: LINE_HEIGHT,
marginTop: '1px',
};

const alertDetails: CSSObject = {
Expand Down