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

Profiles SASS rewrite #335

Merged
merged 52 commits into from
Feb 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
bd5991e
started profiles sass refactor
walmat Feb 10, 2019
0aca0b5
couple comments
walmat Feb 11, 2019
19473d3
updated tasks scss that was outdated, and update sass compile command
walmat Feb 11, 2019
e7f642e
fixed unit tests
walmat Feb 12, 2019
221965b
starting work on profiles scss rewrite
walmat Feb 12, 2019
344512b
removed map files, updated profiles layout
walmat Feb 12, 2019
ab1861a
updated to profiles sass rewrite
walmat Feb 13, 2019
668675c
profiles page semi-done, needs cleaning up
walmat Feb 13, 2019
4b74224
Update packages/frontend/src/app.jsx
walmat Feb 16, 2019
c18f160
Update packages/frontend/src/app.jsx
walmat Feb 16, 2019
ecbd9a3
Update packages/frontend/src/navbar/navbar.jsx
walmat Feb 16, 2019
6bf320d
Update packages/frontend/src/navbar/navbar.jsx
walmat Feb 16, 2019
c705e75
Update packages/frontend/src/navbar/navbar.jsx
walmat Feb 16, 2019
922d933
Update packages/frontend/src/state/actions/navbar/navbarActions.js
walmat Feb 16, 2019
81d11cf
Update packages/frontend/src/state/actions/navbar/navbarActions.js
walmat Feb 16, 2019
3e80189
Update packages/frontend/src/state/actions/navbar/navbarActions.js
walmat Feb 16, 2019
2285e94
Update packages/frontend/src/state/actions/navbar/navbarActions.js
walmat Feb 16, 2019
ab59586
cleanup
walmat Feb 16, 2019
dfc70cf
remove unnecessary css
walmat Feb 16, 2019
9e0ae79
Added back in shipping/billing id to location fields
walmat Feb 16, 2019
8bad3dd
made bms visible, needs aligning
walmat Feb 16, 2019
649f614
fix swap proxy infinite loop
walmat Feb 16, 2019
d336dfb
fix swap proxy infinite loop
walmat Feb 16, 2019
29afbdc
started profiles sass refactor
walmat Feb 10, 2019
6577c99
couple comments
walmat Feb 11, 2019
a468285
updated tasks scss that was outdated, and update sass compile command
walmat Feb 11, 2019
53f818d
fixed unit tests
walmat Feb 12, 2019
b3b3431
starting work on profiles scss rewrite
walmat Feb 12, 2019
966ec4f
removed map files, updated profiles layout
walmat Feb 12, 2019
5ab57b9
updated to profiles sass rewrite
walmat Feb 13, 2019
c9bab3a
profiles page semi-done, needs cleaning up
walmat Feb 13, 2019
44f12d5
Update packages/frontend/src/app.jsx
walmat Feb 16, 2019
84e1d18
Update packages/frontend/src/app.jsx
walmat Feb 16, 2019
af5fa15
Update packages/frontend/src/navbar/navbar.jsx
walmat Feb 16, 2019
eab3077
Update packages/frontend/src/navbar/navbar.jsx
walmat Feb 16, 2019
0674dd6
Update packages/frontend/src/navbar/navbar.jsx
walmat Feb 16, 2019
e48541a
Update packages/frontend/src/state/actions/navbar/navbarActions.js
walmat Feb 16, 2019
81e274d
Update packages/frontend/src/state/actions/navbar/navbarActions.js
walmat Feb 16, 2019
bd478d4
Update packages/frontend/src/state/actions/navbar/navbarActions.js
walmat Feb 16, 2019
59091ce
Update packages/frontend/src/state/actions/navbar/navbarActions.js
walmat Feb 16, 2019
96acbbd
cleanup
walmat Feb 16, 2019
26e0461
remove unnecessary css
walmat Feb 16, 2019
7a0631d
Added back in shipping/billing id to location fields
walmat Feb 16, 2019
bafba03
made bms visible, needs aligning
walmat Feb 16, 2019
321d82a
some test fixes
walmat Feb 16, 2019
ca5db81
added bms back in
walmat Feb 16, 2019
150d615
fixed tests, need to move bms tests to location still
walmat Feb 16, 2019
b097df3
merge upstream
walmat Feb 16, 2019
558025c
lint fix...
walmat Feb 16, 2019
019ca9c
small styling changes
walmat Feb 16, 2019
0a74c79
compiled css changed
walmat Feb 17, 2019
bb72af6
added test ids for later PR, also removed redundant code
walmat Feb 18, 2019
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
94 changes: 64 additions & 30 deletions packages/frontend/src/__tests__/profiles/locationFields.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,40 @@ describe('<LocationFields />', () => {
value={{ ...initialProfileStates.location }}
/>,
);
expect(wrapper.find('#test-first-name')).toHaveLength(1);
expect(wrapper.find('#test-last-name')).toHaveLength(1);
expect(wrapper.find('#test-address-one')).toHaveLength(1);
expect(wrapper.find('#test-address-two')).toHaveLength(1);
expect(wrapper.find('#test-city')).toHaveLength(1);
expect(wrapper.find('#test-province')).toHaveLength(1);
expect(wrapper.find('#test-zip-code')).toHaveLength(1);
expect(wrapper.find('#test-country')).toHaveLength(1);
expect(wrapper.find('#test-phone')).toHaveLength(1);
expect(wrapper.find('#test-first-name').prop('disabled')).toBeFalsy();
expect(wrapper.find('#test-last-name').prop('disabled')).toBeFalsy();
expect(wrapper.find('#test-address-one').prop('disabled')).toBeFalsy();
expect(wrapper.find('#test-address-two').prop('disabled')).toBeFalsy();
expect(wrapper.find('#test-city').prop('disabled')).toBeFalsy();
expect(wrapper.find('#test-province').prop('isDisabled')).toBeFalsy();
expect(wrapper.find('#test-zip-code').prop('disabled')).toBeFalsy();
expect(wrapper.find('#test-country').prop('isDisabled')).toBeFalsy();
expect(wrapper.find('#test-phone').prop('disabled')).toBeFalsy();
expect(wrapper.find('.test-profiles-location__input-group--first-name')).toHaveLength(1);
pr1sm marked this conversation as resolved.
Show resolved Hide resolved
expect(wrapper.find('.test-profiles-location__input-group--last-name')).toHaveLength(1);
expect(wrapper.find('.test-profiles-location__input-group--address-one')).toHaveLength(1);
expect(wrapper.find('.test-profiles-location__input-group--address-two')).toHaveLength(1);
expect(wrapper.find('.test-profiles-location__input-group--city')).toHaveLength(1);
expect(wrapper.find('.test-profiles-location__input-group--province')).toHaveLength(1);
expect(wrapper.find('.test-profiles-location__input-group--zip-code')).toHaveLength(1);
expect(wrapper.find('.test-profiles-location__input-group--country')).toHaveLength(1);
expect(wrapper.find('.test-profiles-location__input-group--phone')).toHaveLength(1);
expect(
wrapper.find('.test-profiles-location__input-group--first-name').prop('disabled'),
).toBeFalsy();
expect(
wrapper.find('.test-profiles-location__input-group--last-name').prop('disabled'),
).toBeFalsy();
expect(
wrapper.find('.test-profiles-location__input-group--address-one').prop('disabled'),
).toBeFalsy();
expect(
wrapper.find('.test-profiles-location__input-group--address-two').prop('disabled'),
).toBeFalsy();
expect(wrapper.find('.test-profiles-location__input-group--city').prop('disabled')).toBeFalsy();
expect(
wrapper.find('.test-profiles-location__input-group--province').prop('isDisabled'),
).toBeFalsy();
expect(
wrapper.find('.test-profiles-location__input-group--zip-code').prop('disabled'),
).toBeFalsy();
expect(
wrapper.find('.test-profiles-location__input-group--country').prop('isDisabled'),
).toBeFalsy();
expect(
wrapper.find('.test-profiles-location__input-group--phone').prop('disabled'),
).toBeFalsy();
});

it('should render with disabled styling', () => {
Expand All @@ -51,15 +67,33 @@ describe('<LocationFields />', () => {
value={{ ...initialProfileStates.location }}
/>,
);
expect(wrapper.find('#test-first-name').prop('disabled')).toBeTruthy();
expect(wrapper.find('#test-last-name').prop('disabled')).toBeTruthy();
expect(wrapper.find('#test-address-one').prop('disabled')).toBeTruthy();
expect(wrapper.find('#test-address-two').prop('disabled')).toBeTruthy();
expect(wrapper.find('#test-city').prop('disabled')).toBeTruthy();
expect(wrapper.find('#test-province').prop('isDisabled')).toBeTruthy();
expect(wrapper.find('#test-zip-code').prop('disabled')).toBeTruthy();
expect(wrapper.find('#test-country').prop('isDisabled')).toBeTruthy();
expect(wrapper.find('#test-phone').prop('disabled')).toBeTruthy();
expect(
wrapper.find('.test-profiles-location__input-group--first-name').prop('disabled'),
).toBeTruthy();
expect(
wrapper.find('.test-profiles-location__input-group--last-name').prop('disabled'),
).toBeTruthy();
expect(
wrapper.find('.test-profiles-location__input-group--address-one').prop('disabled'),
).toBeTruthy();
expect(
wrapper.find('.test-profiles-location__input-group--address-two').prop('disabled'),
).toBeTruthy();
expect(
wrapper.find('.test-profiles-location__input-group--city').prop('disabled'),
).toBeTruthy();
expect(
wrapper.find('.test-profiles-location__input-group--province').prop('isDisabled'),
).toBeTruthy();
expect(
wrapper.find('.test-profiles-location__input-group--zip-code').prop('disabled'),
).toBeTruthy();
expect(
wrapper.find('.test-profiles-location__input-group--country').prop('isDisabled'),
).toBeTruthy();
expect(
wrapper.find('.test-profiles-location__input-group--phone').prop('disabled'),
).toBeTruthy();
});

describe('should render correct values for', () => {
Expand All @@ -77,14 +111,14 @@ describe('<LocationFields />', () => {
disabled={disabled}
/>,
);
let inputField = wrapper.find(`#test-${id}`);
let inputField = wrapper.find(`.test-profiles-location__input-group--${id}`);
expect(inputField.prop('value')).toEqual(value1);
input[field] = value2;
wrapper.setProps({
...wrapper.props(),
value: input,
});
inputField = wrapper.find(`#test-${id}`);
inputField = wrapper.find(`.test-profiles-location__input-group--${id}`);
expect(inputField.prop('value')).toEqual(value2);
};

Expand Down Expand Up @@ -164,7 +198,7 @@ describe('<LocationFields />', () => {
disabled={false}
/>,
);
const inputField = wrapper.find(`#test-${id}`);
const inputField = wrapper.find(`.test-profiles-location__input-group--${id}`);
inputField.simulate('change', event);
expect(onChangeHandler).toHaveBeenCalledWith(expectedCall);
};
Expand Down
14 changes: 7 additions & 7 deletions packages/frontend/src/__tests__/profiles/paymentFields.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ describe('<PaymentFields />', () => {
const wrapper = shallow(
<PaymentFieldsPrimitive onChange={() => {}} value={payment} errors={payment.errors} />,
);
expect(wrapper.find('#email')).toHaveLength(1);
expect(wrapper.find('#expiration')).toHaveLength(1);
expect(wrapper.find('#card-number')).toHaveLength(1);
expect(wrapper.find('#cvv')).toHaveLength(1);
expect(wrapper.find('.profiles-payment__input-group--email')).toHaveLength(1);
expect(wrapper.find('.profiles-payment__input-group--expiration')).toHaveLength(1);
expect(wrapper.find('.profiles-payment__input-group--card-number')).toHaveLength(1);
expect(wrapper.find('.profiles-payment__input-group--cvv')).toHaveLength(1);
});

describe('should render correct values for', () => {
Expand All @@ -33,7 +33,7 @@ describe('<PaymentFields />', () => {
const wrapper = shallow(
<PaymentFieldsPrimitive onChange={() => {}} value={payment} errors={payment.errors} />,
);
let inputField = wrapper.find(`#${id}`);
let inputField = wrapper.find(`.profiles-payment__input-group--${id}`);
expect(inputField).toHaveLength(1);
expect(inputField.prop('value')).toBe(value1);

Expand All @@ -42,7 +42,7 @@ describe('<PaymentFields />', () => {
...wrapper.props(),
value: payment,
});
inputField = wrapper.find(`#${id}`);
inputField = wrapper.find(`.profiles-payment__input-group--${id}`);
expect(inputField).toHaveLength(1);
expect(inputField.prop('value')).toBe(value2);
};
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('<PaymentFields />', () => {
const wrapper = shallow(
<PaymentFieldsPrimitive onChange={onChangeHandler} value={input} errors={input.errors} />,
);
const inputField = wrapper.find(`#${id}`);
const inputField = wrapper.find(`.profiles-payment__input-group--${id}`);
expect(inputField).toHaveLength(1);
inputField.simulate('change', event);
expect(onChangeHandler).toHaveBeenCalledWith(expectedCall);
Expand Down
48 changes: 24 additions & 24 deletions packages/frontend/src/__tests__/profiles/profiles.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ describe('<Profiles />', () => {
const wrapper = renderShallowWithProps();
expect(wrapper).toBeDefined();
expect(wrapper.find('.container')).toHaveLength(1);
expect(wrapper.find('#profile-load')).toHaveLength(1);
expect(wrapper.find('#load-profile')).toHaveLength(1);
expect(wrapper.find('#billing-match-shipping')).toHaveLength(1);
expect(wrapper.find('.profiles-load__input-group--select')).toHaveLength(1);
expect(wrapper.find('.profiles-load__input-group--load')).toHaveLength(1);
// expect(wrapper.find('#billing-match-shipping')).toHaveLength(1);
pr1sm marked this conversation as resolved.
Show resolved Hide resolved
expect(wrapper.find(LocationFields)).toHaveLength(2);
expect(wrapper.find(PaymentFields)).toHaveLength(1);
expect(wrapper.find('#profile-save')).toHaveLength(1);
expect(wrapper.find('#submit-profile')).toHaveLength(1);
expect(wrapper.find('#delete-profile')).toHaveLength(1);
wrapper
.find('#billing-match-shipping')
.parent()
.simulate('keyPress');
expect(wrapper.find('.profiles__fields--name')).toHaveLength(1);
expect(wrapper.find('.profiles__fields--save')).toHaveLength(1);
expect(wrapper.find('.profiles-load__input-group--delete')).toHaveLength(1);
// wrapper
// .find('#billing-match-shipping')
// .parent()
// .simulate('keyPress');
});

describe('should render correct values for', () => {
Expand All @@ -86,7 +86,7 @@ describe('<Profiles />', () => {
}));
const expectedSelectedOption = { value: 1, label: 'profile1' };
const wrapper = renderShallowWithProps(customProps);
const profileSelector = wrapper.find('#profile-load');
const profileSelector = wrapper.find('.profiles-load__input-group--select');
expect(profileSelector.prop('value')).toEqual(expectedSelectedOption);
expect(profileSelector.prop('options')).toEqual(expectedOptions);
});
Expand All @@ -107,7 +107,7 @@ describe('<Profiles />', () => {
});

describe('billing matches shipping field', () => {
test('when true', () => {
test.skip('when true', () => {
const customProps = {
currentProfile: {
...initialProfileStates.profile,
Expand All @@ -119,7 +119,7 @@ describe('<Profiles />', () => {
expect(checkbox.prop('alt')).toBe('Billing Matches Shipping');
});

test('when false', () => {
test.skip('when false', () => {
const customProps = {
currentProfile: {
...initialProfileStates.profile,
Expand Down Expand Up @@ -158,7 +158,7 @@ describe('<Profiles />', () => {
},
};
const wrapper = renderShallowWithProps(customProps);
const billingFields = wrapper.find('#billing');
const billingFields = wrapper.find('.profiles__fields--billing');
expect(billingFields.is(LocationFields)).toBeTruthy();
expect(billingFields.prop('profileToEdit')).toBe(customProps.currentProfile);
expect(billingFields.prop('fieldToEdit')).toBe(PROFILE_FIELDS.EDIT_BILLING);
Expand All @@ -171,7 +171,7 @@ describe('<Profiles />', () => {
currentProfile: { ...initialProfileStates.profile },
};
const wrapper = renderShallowWithProps(customProps);
const paymentFields = wrapper.find('#payment');
const paymentFields = wrapper.find('.profiles__fields--payment');
expect(paymentFields.is(PaymentFields)).toBeTruthy();
expect(paymentFields.prop('profileToEdit')).toBe(customProps.currentProfile);
});
Expand All @@ -184,7 +184,7 @@ describe('<Profiles />', () => {
},
};
const wrapper = renderShallowWithProps(customProps);
const profileName = wrapper.find('#profile-save');
const profileName = wrapper.find('.profiles__fields--name');
expect(profileName.prop('value')).toBe('currentProfile');
});
});
Expand All @@ -205,7 +205,7 @@ describe('<Profiles />', () => {
onSelectProfile: jest.fn(),
};
const wrapper = renderShallowWithProps(customProps);
const profileSelector = wrapper.find('#profile-load');
const profileSelector = wrapper.find('.profiles-load__input-group--select');
profileSelector.simulate('change', { value: 2 });
expect(customProps.onSelectProfile).toHaveBeenCalledWith(customProps.profiles[1]);
});
Expand All @@ -225,12 +225,12 @@ describe('<Profiles />', () => {
onLoadProfile: jest.fn(),
};
const wrapper = renderShallowWithProps(customProps);
const profileLoader = wrapper.find('#load-profile');
const profileLoader = wrapper.find('.profiles-load__input-group--load');
profileLoader.simulate('click');
expect(customProps.onLoadProfile).toHaveBeenCalledWith(customProps.selectedProfile);
});

test('clicking the billing matches shipping box', () => {
test.skip('clicking the billing matches shipping box', () => {
const customProps = {
currentProfile: {
...initialProfileStates.profile,
Expand All @@ -254,7 +254,7 @@ describe('<Profiles />', () => {
onProfileNameChange: jest.fn(),
};
const wrapper = renderShallowWithProps(customProps);
const profileField = wrapper.find('#profile-save');
const profileField = wrapper.find('.profiles__fields--name');
const expectedEvent = { target: { value: 'test' } };
profileField.simulate('change', expectedEvent);
expect(customProps.onProfileNameChange).toHaveBeenCalledWith(expectedEvent);
Expand All @@ -263,7 +263,7 @@ describe('<Profiles />', () => {
describe('saving a profile', () => {
const testSaving = customProps => {
const wrapper = renderShallowWithProps(customProps);
const submitProfile = wrapper.find('#submit-profile');
const submitProfile = wrapper.find('.profiles__fields--save');
const event = { preventDefault: jest.fn() };
submitProfile.simulate('click', event);
expect(event.preventDefault).toHaveBeenCalled();
Expand Down Expand Up @@ -332,7 +332,7 @@ describe('<Profiles />', () => {
onUpdateProfile: jest.fn(),
};
const wrapper = renderShallowWithProps(customProps);
const submitProfile = wrapper.find('#submit-profile');
const submitProfile = wrapper.find('.profiles__fields--save');
const event = { preventDefault: jest.fn() };
submitProfile.simulate('click', event);
expect(event.preventDefault).toHaveBeenCalled();
Expand All @@ -349,15 +349,15 @@ describe('<Profiles />', () => {
onDestroyProfile: jest.fn(),
};
const wrapper = renderShallowWithProps(customProps);
const profileDeleter = wrapper.find('#delete-profile');
const profileDeleter = wrapper.find('.profiles-load__input-group--delete');
const event = { preventDefault: jest.fn() };
profileDeleter.simulate('click', event);
expect(event.preventDefault).toHaveBeenCalled();
expect(customProps.onDestroyProfile).toHaveBeenCalledWith(customProps.selectedProfile);
});
});

test('responds to a key press event', () => {
test.skip('responds to a key press event', () => {
const keyPressHandler = jest.fn();
const customProps = {
onKeyPress: keyPressHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ describe('navbar actions', () => {

it('should create an action to route to home', () => {
const routeAction = navbarActions.routeHome(mockHistory);
const expectedActions = [{ type: NAVBAR_ACTIONS.ROUTE_HOME, history: mockHistory }];
routeTests(routeAction, ROUTES.HOME, expectedActions);
const expectedActions = [{ type: NAVBAR_ACTIONS.ROUTE_TASKS, history: mockHistory }];
routeTests(routeAction, ROUTES.TASKS, expectedActions);
});

it('should create an action to route to profiles', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/__tests__/tasks/taskRow.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ describe('<TaskRow />', () => {
};
const wrapper = renderShallowWithProps(customProps);
initialTests(wrapper);
testTableRowValues(wrapper, { account: 'user' });
testTableRowValues(wrapper, { account: 'Yes' });
pr1sm marked this conversation as resolved.
Show resolved Hide resolved
});
});

Expand Down Expand Up @@ -495,7 +495,7 @@ describe('<TaskRow />', () => {
};
const wrapper = renderShallowWithProps(customProps);
initialTests(wrapper);
testTableRowValues(wrapper, { account: 'user' });
testTableRowValues(wrapper, { account: 'Yes' });
walmat marked this conversation as resolved.
Show resolved Hide resolved
testEditMenuValues(wrapper, {});
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ button:focus {
}

input, select {
text-transform: capitalize;
text-transform: none;
padding-left: 7.5px;
padding-right: 7.5px;
box-sizing: border-box;
Expand Down
Loading