@Willibaur wrote:
Hi all, I’m trying to stub the following within a rendering component test
breadcrumb: computed('router._router.currentPath', function() { const routeName = this.get('router._router.currentPath').replace('index.index', 'index'); const { breadCrumb } = getOwner(this).lookup(`route:${routeName}`); }),
So far I have managed to do it for
routeName
but I don’t understand how to stubbreadCrumb
This is what I have so far:
test('IS mobile View', async function (assert) { setMobileViewStatus(this, true); const transitionTo = path => assert.equal(path, 'foo', `transition to correct path \`${path}\``); const router = { _router: { currentPath: 'foo.index' }, transitionTo }; this.setProperties({ router }); await render(hbs`{{sp-bootstrap/mobile/header router=router}}`); const hasMobileViewClass = find('.nav-masterhead-mobile'); assert.ok(hasMobileViewClass, 'HEADER is rendered on mobile' ); });
Is there a way to stub the whole computed property and make it return whatever I want?
Thanks for your help
Posts: 2
Participants: 2