How to spyOn a property called in a function?

I need to spyOn the ‘offsetWidth’ because the value is now undefined.
getCurrentPage is a function which get the element based on the id currentpage.

The spy on the getCurrentPage works, but I need also to declare the offsetWidth. But that didn’t work.

Functions:

getCurrentPage() {
    return this.$document[0].getElementById('currentPage');
}

calculateStep() {
    this.stepWidth = this.getCurrentPage().offsetWidth / (this.totalSteps - 1);
    return this.stepWidth;
}

Unit test:

let stepWidth = new StepController();
stepWidth.totalSteps = 5;

const dummyCurrentPage = '<div id="currentPage" style="width: 20%;"></div>';

spyOn(stepWidth, 'getCurrentPage').and.returnValue(dummyCurrentPage);

const expectedResult = '200 / 4';

const result = stepWidth.calculateStep();

expect(result).toBe(expectedResult);
});

How can I spyOn the offsetWidth of this.getCurrentPage().offsetWidth ?

Source: New feed
Source Url How to spyOn a property called in a function?