File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ export default {
112112
113113 provide () {
114114 return {
115+ appName: this .appName ,
115116 ' NcContent:setHasAppNavigation' : this .setAppNavigation ,
116117 ' NcContent:selector' : ' #content-vue' ,
117118 }
Original file line number Diff line number Diff line change 1+ /*!
2+ * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
3+ * SPDX-License-Identifier: AGPL-3.0-or-later
4+ */
5+
6+ import { describe , expect , it } from '@jest/globals'
7+ import { mount } from '@vue/test-utils'
8+ import { defineComponent } from 'vue'
9+ import NcContent from '../../../src/components/NcContent/NcContent.vue'
10+ import { useAppName } from '../../../src/utils/appName.ts'
11+
12+ const TestComponent = defineComponent ( {
13+ template : '<div>{{ appName }}</div>' ,
14+ setup ( ) {
15+ return { appName : useAppName ( ) }
16+ } ,
17+ } )
18+
19+ const WrappedTestComponent = defineComponent ( {
20+ template : '<NcContent app-name="custom_app"><TestComponent /></NcContent>' ,
21+ components : { NcContent, TestComponent } ,
22+ } )
23+
24+ describe ( 'useAppName' , ( ) => {
25+ it ( 'should return the fallback app name' , ( ) => {
26+ const wrapper = mount ( TestComponent )
27+ expect ( wrapper . text ( ) ) . toBe ( 'nextcloud-vue' )
28+ } )
29+
30+ it ( 'should return the app name injected by NcContent' , ( ) => {
31+ const wrapper = mount ( WrappedTestComponent )
32+ expect ( wrapper . text ( ) ) . toBe ( 'custom_app' )
33+ } )
34+ } )
You can’t perform that action at this time.
0 commit comments