Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add theas property in theCHeader component to use semantic tag#290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mrholek merged 1 commit intocoreui:mainfromcesargb:tag_semantic_header
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
9 changes: 8 additions & 1 deletionpackages/coreui-vue/src/components/header/CHeader.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,13 @@ import { defineComponent, h } from 'vue'
const CHeader = defineComponent({
name: 'CHeader',
props: {
/**
* Component used for the root node. Either a string to use a HTML element or a component.
*/
as: {
type: String,
default: 'div',
},
/**
* Defines optional container wrapping children elements.
*
Expand DownExpand Up@@ -31,7 +38,7 @@ const CHeader = defineComponent({
setup(props, { slots }) {
return () =>
h(
'div',
props.as,
{ class: ['header', { [`header-${props.position}`]: props.position }] },
props.container
? h(
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,6 +20,15 @@ const customWrapper = mount(Component, {
},
})

const customWrapperTwo = mount(Component, {
propsData: {
as: 'header',
},
slots: {
default: 'Default slot',
},
})

describe(`Loads and display ${ComponentName} component`, () => {
it('has a name', () => {
expect(Component.name).toMatch(ComponentName)
Expand All@@ -44,3 +53,13 @@ describe(`Customize ${ComponentName} component`, () => {
expect(customWrapper.find('.container-lg').classes('container-lg')).toBe(true)
})
})


describe(`Customize (number two) ${ComponentName} component`, () => {
it('renders correctly', () => {
expect(customWrapperTwo.html()).toMatchSnapshot()
})
it('tag name is custom', () => {
expect(customWrapperTwo.element.tagName).toBe('HEADER')
})
})
9 changes: 5 additions & 4 deletionspackages/docs/api/header/CHeader.api.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,8 @@ import CHeader from '@coreui/vue/src/components/header/CHeader'

#### Props

| Prop name | Description | Type | Values | Default |
| ------------- | ------------------------------------------------------ | --------------- | ------------------------------------------------------------- | ------- |
| **container** | Defines optional container wrapping children elements. | boolean\|string | `boolean`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'xxl'`, `'fluid'` | - |
| **position** | Place header in non-static positions. | string | `'fixed'`, `'sticky'` | - |
| Prop name | Description | Type | Values | Default |
| ------------- | --------------------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------- | ------- |
| **as** | Component used for the root node. Either a string to use a HTML element or a component. | string | - | 'div' |
| **container** | Defines optional container wrapping children elements. | boolean\|string | `boolean`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'xxl'`, `'fluid'` | - |
| **position** | Place header in non-static positions. | string | `'fixed'`, `'sticky'` | - |

[8]ページ先頭

©2009-2025 Movatter.jp