Skip to content

feat(*): private property #1095

Merged
merged 2 commits into from
Mar 14, 2020
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
8 changes: 4 additions & 4 deletions src/calendar-input/calendar-input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('calendar-input', () => {

it('should focus input on after `focus` call', () => {
const calendarInput = mount<CalendarInput>(<CalendarInput />);
const focusTarget = calendarInput.instance().customCalendarTarget;
const focusTarget = (calendarInput.instance() as any).customCalendarTarget;

jest.spyOn(focusTarget, 'focus');

Expand All @@ -89,7 +89,7 @@ describe('calendar-input', () => {

it('should blur input on after `blur` call', () => {
const calendarInput = mount<CalendarInput>(<CalendarInput />);
const focusTarget = calendarInput.instance().customCalendarTarget;
const focusTarget = (calendarInput.instance() as any).customCalendarTarget;

jest.spyOn(focusTarget, 'blur');

Expand Down Expand Up @@ -282,7 +282,7 @@ describe('calendar-input', () => {

it('should focus on input after escape key was pressed in calendar', () => {
const wrapper = mount<CalendarInput>(<CalendarInput />);
const calendarTarget = wrapper.instance().customCalendarTarget;
const calendarTarget = (wrapper.instance() as any).customCalendarTarget;
const calendarNode = wrapper.find('.calendar');

jest.spyOn(calendarTarget, 'focus');
Expand All @@ -294,7 +294,7 @@ describe('calendar-input', () => {

it('should focus on input after calendar icon was clicked', () => {
const wrapper = mount<CalendarInput>(<CalendarInput />);
const calendarTarget = wrapper.instance().customCalendarTarget;
const calendarTarget = (wrapper.instance() as any).customCalendarTarget;

jest.spyOn(calendarTarget, 'focus');
const iconNode = wrapper.find('.icon');
Expand Down
3 changes: 1 addition & 2 deletions src/calendar-input/calendar-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ export class CalendarInput extends React.Component<CalendarInputProps> {
/**
* @type {Input}
*/
// TODO [issues/1018] переписать тесты нужно, что бы private был
customCalendarTarget;
private customCalendarTarget;

private nativeCalendarTarget;

Expand Down
4 changes: 3 additions & 1 deletion src/checkbox-group/checkbox-group.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ describe('checkbox-group', () => {
});

it('should focus first child checkbox-button on public focus method', () => {

const checkboxGroup = mount<CheckBoxGroup>(
<CheckBoxGroup>
<CheckBox />
<CheckBox />
<CheckBox />
</CheckBoxGroup>
);
const firstCheckboxInstance = checkboxGroup.instance().checkboxes[0];

const firstCheckboxInstance = (checkboxGroup.instance() as any).checkboxes[0];

jest.spyOn(firstCheckboxInstance, 'focus');
checkboxGroup.instance().focus();
Expand Down
4 changes: 1 addition & 3 deletions src/checkbox-group/checkbox-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ export class CheckBoxGroup extends React.PureComponent<CheckBoxGroupProps> {
value: []
};

// TODO [issues/1018] переписать тесты нужно, что бы private был
checkboxes: any[];
private checkboxes: any[];

render() {
let children = null;
Expand Down Expand Up @@ -215,7 +214,6 @@ export class CheckBoxGroup extends React.PureComponent<CheckBoxGroupProps> {
this.checkboxes[0].focus();
}
}

/**
* Убирает фокус с группы чекбокс-кнопок.
*/
Expand Down