Skip to content

Commit

Permalink
fix unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
lookacat committed Dec 7, 2021
1 parent 552866a commit 96bee10
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
exports[`List component when no resource is found should show no-content-message component 1`] = `
<div class="files-search-result">
<div class="uk-height-1-1 uk-flex uk-flex-column uk-flex-center uk-flex-middle uk-text-center files-empty">
<div class="oc-icon oc-icon-xxl oc-icon-passive"><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" version="1.0" viewBox="0 0 16 16" height="16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" aria-hidden="true" focusable="false">
<g xmlns="http://www.w3.org/2000/svg" transform="matrix(.86667 0 0 .86667 -172.05 -864.43)">
<path d="m200.2 999.72c-0.28913 0-0.53125 0.2421-0.53125 0.53117v12.784c0 0.2985 0.23264 0.5312 0.53125 0.5312h15.091c0.2986 0 0.53124-0.2327 0.53124-0.5312l0.0004-10.474c0-0.2889-0.24211-0.5338-0.53124-0.5338l-7.5457 0.0005-2.3076-2.3078z"></path>
</g>
<div class="oc-icon oc-icon-xxl oc-icon-passive"><svg height="24" width="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
<path xmlns="http://www.w3.org/2000/svg" fill="none" d="M0 0h24v24H0z"></path>
<path xmlns="http://www.w3.org/2000/svg" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414l2 2z"></path>
</svg></div>
<div class="oc-text-muted uk-text-large">
<p class="oc-text-muted"><span data-msgid="No search term entered" data-current-language="en_US">No search term entered</span></p>
Expand All @@ -19,10 +18,9 @@ exports[`List component when no resource is found should show no-content-message
exports[`List component when no search term is entered should show no-content-message component 1`] = `
<div class="files-search-result">
<div class="uk-height-1-1 uk-flex uk-flex-column uk-flex-center uk-flex-middle uk-text-center files-empty">
<div class="oc-icon oc-icon-xxl oc-icon-passive"><svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" version="1.0" viewBox="0 0 16 16" height="16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" aria-hidden="true" focusable="false">
<g xmlns="http://www.w3.org/2000/svg" transform="matrix(.86667 0 0 .86667 -172.05 -864.43)">
<path d="m200.2 999.72c-0.28913 0-0.53125 0.2421-0.53125 0.53117v12.784c0 0.2985 0.23264 0.5312 0.53125 0.5312h15.091c0.2986 0 0.53124-0.2327 0.53124-0.5312l0.0004-10.474c0-0.2889-0.24211-0.5338-0.53124-0.5338l-7.5457 0.0005-2.3076-2.3078z"></path>
</g>
<div class="oc-icon oc-icon-xxl oc-icon-passive"><svg height="24" width="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
<path xmlns="http://www.w3.org/2000/svg" fill="none" d="M0 0h24v24H0z"></path>
<path xmlns="http://www.w3.org/2000/svg" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414l2 2z"></path>
</svg></div>
<div class="oc-text-muted uk-text-large">
<p class="oc-text-muted"><span data-msgid="No search term entered" data-current-language="en_US">No search term entered</span></p>
Expand Down
26 changes: 6 additions & 20 deletions packages/web-runtime/tests/unit/components/TopBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ const localVue = createLocalVue()
localVue.use(Vuex)

const feedbackButtonPresent = (enabled) => ({
options: { disableFeedbackLink: !enabled }
options: { disableFeedbackLink: !enabled },
theme: {
logo: {
sidebar: ''
}
}
})

const defaultRoute = () => ({
Expand Down Expand Up @@ -39,23 +44,4 @@ describe('Top Bar component', () => {
expect(wrapper.html().indexOf('applications-menu-stub')).toBeGreaterThan(-1)
expect(wrapper).toMatchSnapshot()
})

it('Emits toggle of app navigation visibility', async () => {
const wrapper = shallowMount(TopBar, {
store: new Vuex.Store({
getters: {
configuration: () => feedbackButtonPresent(true)
}
}),
localVue,
stubs,
mocks: {
$route: defaultRoute()
}
})

wrapper.find('.oc-app-navigation-toggle').vm.$emit('click')
await wrapper.vm.$nextTick()
expect(wrapper.emitted().toggleAppNavigationVisibility).toBeTruthy()
})
})
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ApplicationsMenu component shoud set aria-label prop on switcher button 1`] = `
<oc-button-stub type="button" size="medium" arialabel="Application Switcher" variation="passive" appearance="raw" justifycontent="center" gapsize="medium" id="_appSwitcherButton" class="oc-topbar-menu-burger">
<oc-icon-stub name="apps" accessiblelabel="" type="span" size="medium" variation="passive" class="uk-flex"></oc-icon-stub>
<oc-button-stub type="button" size="medium" arialabel="Application Switcher" variation="inverse" appearance="raw" justifycontent="center" gapsize="medium" id="_appSwitcherButton" class="oc-topbar-menu-burger">
<oc-icon-stub name="apps" accessiblelabel="" type="span" size="large" variation="passive" class="uk-flex"></oc-icon-stub>
</oc-button-stub>
`;

Expand All @@ -14,8 +14,8 @@ exports[`ApplicationsMenu component should show app menus 1`] = `
<oc-icon-stub name="folder" accessiblelabel="" type="span" size="xlarge" variation="passive"></oc-icon-stub> <span class="uk-display-block">Files</span>
</router-link-stub>
</li>
<li class="uk-width-1-3"><a target="_blank" href="http://some.org">
<oc-icon-stub name="some-icon" accessiblelabel="" type="span" size="xlarge" variation="passive"></oc-icon-stub> <span class="uk-display-block">External</span>
<li class="oc-pt-s oc-pb-s" style="list-style: none;"><a target="_blank" href="http://some.org" style="display: inline-flex; vertical-align: top; gap: 10px;">
<oc-icon-stub name="some-icon" accessiblelabel="" type="span" size="medium" variation="passive"></oc-icon-stub> <span>External</span>
</a></li>
</ul>
</oc-drop-stub>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FeedbackLink component has no accessibility violations 1`] = `
<div class="uk-flex uk-flex-middle"><a aria-label="ownCloud feedback survey" href="https://owncloud.com/web-design-feedback" class="oc-button oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw" target="_blank" aria-describedby="oc-feedback-link-description"><span class="oc-icon oc-icon-m oc-icon-passive"><svg height="24" width="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"> <path xmlns="http://www.w3.org/2000/svg" d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"></path> </svg></span></a>
<div class="uk-flex uk-flex-middle uk-visible@m"><a aria-label="ownCloud feedback survey" href="https://owncloud.com/web-design-feedback" class="oc-button oc-button-m oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw" target="_blank" aria-describedby="oc-feedback-link-description"><span class="oc-icon oc-icon-m oc-icon-inverse"><svg height="24" width="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"> <path xmlns="http://www.w3.org/2000/svg" d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"></path> </svg></span></a>
<p id="oc-feedback-link-description" class="oc-invisible-sr">Provide your feedback: We'd like to improve the web design and would be happy to hear your feedback. Thank you! Your ownCloud team.</p>
</div>
`;
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Top Bar component Displays applications menu 1`] = `
<header aria-label="Top bar" class="oc-topbar uk-flex uk-flex-middle uk-flex-wrap oc-border-b oc-p-s">
<oc-grid-stub gutter="medium" flex="">
<div class="uk-hidden@l">
<oc-button-stub appearance="raw" aria-label="Open navigation menu" class="oc-m-s oc-app-navigation-toggle">
<oc-icon-stub name="menu"></oc-icon-stub>
</oc-button-stub>
</div>
</oc-grid-stub>
<header id="oc-topbar" aria-label="Top bar" class="uk-flex uk-flex-middle uk-flex-between oc-mx-m">
<div class="gap-15 uk-flex uk-flex-middle uk-flex-between">
<applications-menu-stub applicationslist="testApp" class="application-menu"></applications-menu-stub>
<router-link-stub to="/" class="oc-ml-m">
<oc-img-stub src=""></oc-img-stub>
</router-link-stub>
</div>
<div class="portal-wrapper">
<portal-target-stub name="app.runtime.header" multiple=""></portal-target-stub>
</div>
<oc-grid-stub flex="" gutter="small" class="uk-width-expand uk-flex-right oc-m-rm">
<div class="gap-15 uk-flex uk-flex-middle uk-flex-between">
<feedback-link-stub></feedback-link-stub>
<!---->
<applications-menu-stub applicationslist="testApp"></applications-menu-stub>
<user-menu-stub userid="einstein" userdisplayname="Albert Einstein" applicationslist="testApp"></user-menu-stub>
</oc-grid-stub>
</div>
</header>
`;

0 comments on commit 96bee10

Please sign in to comment.