What has to be true if the function CurrentLineHighlightSuspends
is returning a div with the attribute data-test-name
equal to CurrentExecutionPointLineHighlight
?
function CurrentLineHighlightSuspends({
lineNumber,
sourceId
}) {
const client = useContext(ReplayClientContext);
const {
0: sourceSearchState
} = useContext(SourceSearchContext);
const {
selectedPauseAndFrameId,
previewLocation
} = useContext(SelectedFrameContext);
const {
currentSearchResultLocation
} = useContext(SourcesContext);
if (previewLocation?.sourceId === sourceId) {
if (previewLocation.line === lineNumber) {
return /*#__PURE__*/ _jsx("div", {
className: styles.CurrentExecutionPoint,
"data-test-name": "CurrentExecutionPointLineHighlight"
});
}
return null;
}
const frameId = selectedPauseAndFrameId?.frameId || null;
const pauseId = selectedPauseAndFrameId?.pauseId || null;
if (pauseId !== null && frameId !== null) {
const frames = getFramesSuspense(client, pauseId);
if (frames) {
const correspondingSourceIds = client.getCorrespondingSourceIds(sourceId);
const selectedFrame = frames.find(frame => frame.frameId === frameId);
if (selectedFrame) {
if (selectedFrame.location.find(location => {
if (correspondingSourceIds.includes(location.sourceId)) {
const correspondingLocations = client.getCorrespondingLocations(
location);
return correspondingLocations.findIndex(correspondingLocation =>
correspondingLocation.line === lineNumber &&
correspondingLocation.sourceId === sourceId) >= 0;
}
})) {
return /*#__PURE__*/ _jsx("div", {
className: styles.CurrentExecutionPoint,
"data-test-name": "CurrentExecutionPointLineHighlight"
});
}
}
}
}
if (currentSearchResultLocation != null && currentSearchResultLocation
.sourceId === sourceSearchState.currentScopeId &&
currentSearchResultLocation.line === lineNumber) {
return /*#__PURE__*/ _jsx("div", {
className: styles.CurrentSearchResult,
"data-test-name": "CurrentSearchResultHighlight"
});
}
return null;
}
If the CurrentLineHighlightSuspends function is returning a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight, then the following must be true:
-
The previewLocation object exists, and its sourceId property is equal to the sourceId parameter passed to the CurrentLineHighlightSuspends function.
-
The previewLocation object's line property is equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function. OR
-
The selectedPauseAndFrameId object exists and has both frameId and pauseId properties.
-
The function getFramesSuspense returns a truthy value when called with the ReplayClientContext's client object and the selectedPauseAndFrameId object's pauseId property.
-
The selectedFrame variable, which is the result of calling find on the value returned by getFramesSuspense, exists and has a location property.
-
The selectedFrame variable's location property contains an object with a sourceId property that is included in the result of calling getCorrespondingSourceIds on the ReplayClientContext's client object and passing it the sourceId parameter passed to the CurrentLineHighlightSuspends function.
-
The selectedFrame variable's location property contains an object with a line property that is equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function.
OR
- The currentSearchResultLocation variable exists and is not null.
- The currentSearchResultLocation variable's sourceId property is equal to the currentScopeId property of the SourceSearchContext's sourceSearchState object.
- The currentSearchResultLocation variable's line property is equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function.
selectedPauseAndFrameId equals {pauseId: "0027f53e-8035-464e-b7a5-04a18e903a5f", frameId: "0"}
If selectedPauseAndFrameId is equal to {pauseId: "0027f53e-8035-464e-b7a5-04a18e903a5f", frameId: "0"}, then in order for the CurrentLineHighlightSuspends function to return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight, the following must be true:
-
The previewLocation object does not exist, or its sourceId property is not equal to the sourceId parameter passed to the CurrentLineHighlightSuspends function, or its line property is not equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function. AND
-
The getFramesSuspense function returns a truthy value when called with the ReplayClientContext's client object and the selectedPauseAndFrameId object's pauseId property.
-
The selectedFrame variable, which is the result of calling find on the value returned by getFramesSuspense, exists and has a location property.
-
The selectedFrame variable's location property contains an object with a sourceId property that is included in the result of calling getCorrespondingSourceIds on the ReplayClientContext's client object and passing it the sourceId parameter passed to the CurrentLineHighlightSuspends function.
-
The selectedFrame variable's location property contains an object with a line property that is equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function. OR
-
The currentSearchResultLocation variable does not exist or is null.
-
The currentSearchResultLocation variable's sourceId property is not equal to the currentScopeId property of the SourceSearchContext's sourceSearchState object.
-
The currentSearchResultLocation variable's line property is not equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function.
previewLocation is null
If previewLocation is null, then in order for the CurrentLineHighlightSuspends function to return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight, the following must be true:
-
The selectedPauseAndFrameId object exists and has both frameId and pauseId properties.
-
The function getFramesSuspense returns a truthy value when called with the ReplayClientContext's client object and the selectedPauseAndFrameId object's pauseId property.
-
The selectedFrame variable, which is the result of calling find on the value returned by getFramesSuspense, exists and has a location property.
-
The selectedFrame variable's location property contains an object with a sourceId property that is included in the result of calling getCorrespondingSourceIds on the ReplayClientContext's client object and passing it the sourceId parameter passed to the CurrentLineHighlightSuspends function.
-
The selectedFrame variable's location property contains an object with a line property that is equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function. OR
-
The currentSearchResultLocation variable exists and is not null.
-
The currentSearchResultLocation variable's sourceId property is equal to the currentScopeId property of the SourceSearchContext's sourceSearchState object.
-
The currentSearchResultLocation variable's line property is equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function.
here is selectedFrame {"frameId":"0","functionLocation":[{"column":288382,"line":1,"sourceId":"9"},{"sourceId":"pp9","line":17491,"column":13},{"sourceId":"o9-122-f73cce-6da222","line":22,"column":16}],"functionName":"zs","location":[{"sourceId":"9","line":1,"column":288683,"functionId":"15900","offset":1048},{"sourceId":"pp9","line":17501,"column":5},{"sourceId":"o9-122-f73cce-6da222","line":73,"column":2}],"scopeChain":["13","14","15","16","4","5"],"this":{},"type":"call","originalScopeChain":["original:0:0","original:0:1"],"originalFunctionName":"TestCase"}Less
If selectedFrame is equal to
{
"frameId": "0",
"functionLocation": [
{
"column": 288382,
"line": 1,
"sourceId": "9"
},
{
"sourceId": "pp9",
"line": 17491,
"column": 13
},
{
"sourceId": "o9-122-f73cce-6da222",
"line": 22,
"column": 16
}
],
"functionName": "zs",
"location": [
{
"sourceId": "9",
"line": 1,
"column": 288683,
"functionId": "15900",
"offset": 1048
},
{
"sourceId": "pp9",
"line": 17501,
"column": 5
},
{
"sourceId": "o9-122-f73cce-6da222",
"line": 73,
"column": 2
}
],
"scopeChain": [
"13",
"14",
"15",
"16",
"4",
"5"
],
"this": {},
"type": "call",
"originalScopeChain": [
"original:0:0",
"original:0:1"
],
"originalFunctionName": "TestCase"
}
then in order for the CurrentLineHighlightSuspends function to return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight, the following must be true:
- The getCorrespondingSourceIds function, when called on the ReplayClientContext's client object and passed the sourceId parameter passed to the CurrentLineHighlightSuspends function, returns an array that contains at least one of the sourceId properties from the objects in the selectedFrame variable's location property.
- At least one of the objects in the selectedFrame variable's location property has a line property that is equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function, and a sourceId property that is included in the array returned by getCorrespondingSourceIds when called with the ReplayClientContext's client object and the sourceId parameter passed to the CurrentLineHighlightSuspends function.
OR
- The currentSearchResultLocation variable does not exist or is null.
- The currentSearchResultLocation variable's sourceId property is not equal to the currentScopeId property of the SourceSearchContext's sourceSearchState object.
- The currentSearchResultLocation variable's line property is not equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function.
correspondingSourceIds equals ["o9-122-f73cce-6da222"]
If correspondingSourceIds is equal to ["o9-122-f73cce-6da222"], then in order for the CurrentLineHighlightSuspends function to return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight, the following must be true:
-
At least one of the objects in the selectedFrame variable's location property has a line property that is equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function, and a sourceId property that is equal to "o9-122-f73cce-6da222". OR
-
The currentSearchResultLocation variable does not exist or is null.
-
The currentSearchResultLocation variable's sourceId property is not equal to the currentScopeId property of the SourceSearchContext's sourceSearchState object.
-
The currentSearchResultLocation variable's line property is not equal to the lineNumber parameter passed to the CurrentLineHighlightSuspends function.
The lineNumber is 73
If lineNumber is equal to 73, then in order for the CurrentLineHighlightSuspends function to return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight, the following must be true:
-
At least one of the objects in the selectedFrame variable's location property has a line property that is equal to 73, and a sourceId property that is equal to "o9-122-f73cce-6da222". OR
-
The currentSearchResultLocation variable does not exist or is null.
-
The currentSearchResultLocation variable's sourceId property is not equal to the currentScopeId property of the SourceSearchContext's sourceSearchState object.
-
The currentSearchResultLocation variable's line property is not equal to 73.
will we return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight?
In order for the CurrentLineHighlightSuspends function to return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight, the following must be true:
-
At least one of the objects in the selectedFrame variable's location property has a line property that is equal to 73, and a sourceId property that is equal to "o9-122-f73cce-6da222". OR
-
The currentSearchResultLocation variable does not exist or is null.
-
The currentSearchResultLocation variable's sourceId property is not equal to the currentScopeId property of the SourceSearchContext's sourceSearchState object.
-
The currentSearchResultLocation variable's line property is not equal to 73. Without more information, it is impossible to determine whether or not the function will return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight.
currentSearchResultLocation is null
If currentSearchResultLocation is null, then in order for the CurrentLineHighlightSuspends function to return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight, the following must be true:
- At least one of the objects in the selectedFrame variable's location property has a line property that is equal to 73, and a sourceId property that is equal to "o9-122-f73cce-6da222". If currentSearchResultLocation is null and the selectedFrame variable's location property does not contain an object with a line property that is equal to 73 and a sourceId property that is equal to "o9-122-f73cce-6da222", then the CurrentLineHighlightSuspends function will not return a div with the attribute data-test-name equal to CurrentExecutionPointLineHighlight. It will return null.