Skip to content

Commit ccadff5

Browse files
authored
Merge pull request #14 from oslabs-beta/remove-persist-deprecated-feature
Remove persist deprecated feature and debug timeJump
2 parents 88ae2ba + 5b9882e commit ccadff5

File tree

6 files changed

+9
-50
lines changed

6 files changed

+9
-50
lines changed

src/app/__tests__/ButtonContainer.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ describe('Unit testing for ButtonContainer', () => {
2626
mode: {
2727
paused: false,
2828
locked: false,
29-
persist: false,
3029
},
3130
},
3231
},
@@ -47,7 +46,6 @@ describe('Unit testing for ButtonContainer', () => {
4746
mockedUsedStoreContext.mockClear();
4847
currentTab.mode = {
4948
paused: false,
50-
persist: false,
5149
};
5250
});
5351

src/app/__tests__enzyme/ignore/ButtonsContainer.test.tsx

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const state = {
1818
mode: {
1919
paused: false,
2020
locked: false,
21-
persist: false,
2221
},
2322
},
2423
},
@@ -42,7 +41,6 @@ describe('testing the bottom buttons', () => {
4241
useStoreContext.mockClear();
4342
currentTab.mode = {
4443
paused: false,
45-
persist: false,
4644
};
4745
});
4846

@@ -66,24 +64,4 @@ describe('testing the bottom buttons', () => {
6664
});
6765
});
6866

69-
describe.skip('persist button testing', () => {
70-
beforeEach(() => {
71-
wrapper.find('.persist-button').simulate('click');
72-
});
73-
74-
test('persist button dispatches upon click', () => {
75-
expect(dispatch.mock.calls.length).toBe(1);
76-
});
77-
78-
test('persist button dispatches toggleMode action', () => {
79-
expect(dispatch.mock.calls[0][0]).toEqual(toggleMode('persist'));
80-
});
81-
82-
test('persist button displays state', () => {
83-
expect(wrapper.find('.persist-button').text()).toBe('<FontAwesomeIcon />Persist');
84-
state.tabs[state.currentTab].mode.persist = true;
85-
wrapper = shallow(<ButtonsContainer />);
86-
expect(wrapper.find('.persist-button').text()).toBe('<FontAwesomeIcon />Unpersist');
87-
});
88-
});
8967
});

src/app/__tests__enzyme/ignore/mainReducer.test.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ describe('mainReducer testing', () => {
3232
mode: {
3333
paused: false,
3434
locked: false,
35-
persist: false,
3635
},
3736
intervalId: 87,
3837
playing: true,
@@ -116,7 +115,6 @@ describe('mainReducer testing', () => {
116115
mode: {
117116
paused: false,
118117
locked: false,
119-
persist: false,
120118
},
121119
intervalId: 75,
122120
playing: false,
@@ -279,25 +277,16 @@ describe('mainReducer testing', () => {
279277
const { mode } = mainReducer(state, toggleMode('paused')).tabs[currentTab];
280278
expect(mode.paused).toBe(true);
281279
expect(mode.locked).toBe(false);
282-
expect(mode.persist).toBe(false);
283280
});
284281
it('clicking lock button should only change lock mode', () => {
285282
const { mode } = mainReducer(state, toggleMode('locked')).tabs[currentTab];
286283
expect(mode.paused).toBe(false);
287284
expect(mode.locked).toBe(true);
288-
expect(mode.persist).toBe(false);
289-
});
290-
it('clicking persist button should only change persist mode', () => {
291-
const { mode } = mainReducer(state, toggleMode('persist')).tabs[currentTab];
292-
expect(mode.paused).toBe(false);
293-
expect(mode.locked).toBe(false);
294-
expect(mode.persist).toBe(true);
295285
});
296286
it('undefined payload does nothing', () => {
297287
const { mode } = mainReducer(state, toggleMode('undefined')).tabs[currentTab];
298288
expect(mode.paused).toBe(false);
299289
expect(mode.locked).toBe(false);
300-
expect(mode.persist).toBe(false);
301290
});
302291
});
303292

@@ -326,7 +315,6 @@ describe('mainReducer testing', () => {
326315
mode: {
327316
paused: false,
328317
locked: false,
329-
persist: false,
330318
},
331319
intervalId: 912,
332320
playing: true,

src/app/reducers/mainReducer.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,6 @@ export default (state, action) =>
217217
case 'paused':
218218
actionText = 'setPause';
219219
break;
220-
case 'persist':
221-
actionText = 'setPersist';
222-
break;
223220
default:
224221
break;
225222
}

src/backend/controllers/timeJump.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,14 @@ async function updateReactFiberTree(
7070
if (index !== null) {
7171
// Obtain the BOUND update method at the given index
7272
const classComponent = componentActionsRecord.getComponentByIndex(index);
73-
// Update component state
74-
await classComponent.setState(
75-
// prevState contains the states of the snapshots we are jumping FROM, not jumping TO
76-
(prevState) => state,
77-
);
73+
// This conditional avoids the error that occurs when classComponent is undefined
74+
if (classComponent !== undefined) {
75+
// Update component state
76+
await classComponent.setState(
77+
// prevState contains the states of the snapshots we are jumping FROM, not jumping TO
78+
(prevState) => state,
79+
);
80+
}
7881
// Iterate through new children after state has been set
7982
targetSnapshot.children.forEach((child) => updateReactFiberTree(child, circularComponentTable));
8083
return;

src/extension/background.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ function createTabObj(title) {
4242
reactDevToolsInstalled: false,
4343
targetPageisaReactApp: false,
4444
},
45-
// Note: Persist is a now defunct feature. Paused = Locked
45+
// Note: Paused = Locked
4646
mode: {
47-
persist: false,
4847
paused: false,
4948
},
5049
// stores web metrics calculated by the content script file
@@ -204,10 +203,6 @@ chrome.runtime.onConnect.addListener((port) => {
204203
case 'setPause':
205204
tabsObj[tabId].mode.paused = payload;
206205
return true;
207-
// persist is now depreacted
208-
case 'setPersist':
209-
tabsObj[tabId].mode.persist = payload;
210-
return true;
211206
case 'launchContentScript':
212207
chrome.scripting.executeScript({
213208
target: { tabId },

0 commit comments

Comments
 (0)