diff --git a/src/plugin/transform.ts b/src/plugin/transform.ts index 2e23a42..536de4c 100644 --- a/src/plugin/transform.ts +++ b/src/plugin/transform.ts @@ -197,8 +197,9 @@ function insertTabs( const tabPanelOpen = new state.Token('tab-panel_open', 'div', 1); const tabPanelClose = new state.Token('tab-panel_close', 'div', -1); - const verticalTabOpen = new state.Token('tab_open', 'input', 0); - const verticalTabLabelOpen = new state.Token('label_open', 'label', 1); + const verticalTabInput = new state.Token('tab-input', 'input', 0); + const verticalTabLabelOpen = new state.Token('tab-label_open', 'label', 1); + const verticalTabLabelClose = new state.Token('tab-label_close', 'label', -1); tabOpen.map = tabs[i].listItem.map; tabOpen.markup = tabs[i].listItem.markup; @@ -216,10 +217,10 @@ function insertTabs( const tabPanelId = generateID(); - verticalTabOpen.block = true; + verticalTabInput.block = true; - verticalTabOpen.attrJoin('class', 'radio'); - verticalTabOpen.attrSet('type', 'radio'); + verticalTabInput.attrJoin('class', 'radio'); + verticalTabInput.attrSet('type', 'radio'); tabOpen.map = tabs[i].listItem.map; tabOpen.markup = tabs[i].listItem.markup; @@ -252,7 +253,7 @@ function insertTabs( if (isTabActive) { if (align === 'radio') { tabOpen.attrSet(VERTICAL_TAB_FORCED_OPEN, 'true'); - verticalTabOpen.attrSet('checked', 'true'); + verticalTabInput.attrSet('checked', 'true'); tabPanelOpen.attrJoin('class', ACTIVE_CLASSNAME); } else { tabOpen.attrSet(TAB_ACTIVE_KEY, i === 0 ? 'true' : 'false'); @@ -263,7 +264,14 @@ function insertTabs( } if (align === 'radio') { - tabsTokens.push(tabOpen, verticalTabOpen, verticalTabLabelOpen, tabInline, tabClose); + tabsTokens.push( + tabOpen, + verticalTabInput, + verticalTabLabelOpen, + tabInline, + verticalTabLabelClose, + tabClose, + ); tabsTokens.push(tabPanelOpen, ...tabs[i].tokens, tabPanelClose); } else { tabListTokens.push(tabOpen, tabInline, tabClose); diff --git a/test/data/tabs.ts b/test/data/tabs.ts index f44105d..a6b7c7c 100644 --- a/test/data/tabs.ts +++ b/test/data/tabs.ts @@ -1238,7 +1238,7 @@ export const vertical = [ hidden: false, }, { - type: 'tab_open', + type: 'tab-input', tag: 'input', map: null, nesting: 0, @@ -1252,7 +1252,7 @@ export const vertical = [ hidden: false, }, { - type: 'label_open', + type: 'tab-label_open', tag: 'label', map: null, nesting: 1, @@ -1295,6 +1295,20 @@ export const vertical = [ block: false, hidden: false, }, + { + type: 'tab-label_close', + tag: 'label', + map: null, + nesting: -1, + level: 0, + children: null, + content: '', + markup: '', + info: '', + meta: null, + block: false, + hidden: false, + }, { type: 'tab_close', tag: 'div', @@ -1410,7 +1424,7 @@ export const vertical = [ hidden: false, }, { - type: 'tab_open', + type: 'tab-input', tag: 'input', map: null, nesting: 0, @@ -1424,7 +1438,7 @@ export const vertical = [ hidden: false, }, { - type: 'label_open', + type: 'tab-label_open', tag: 'label', map: null, nesting: 1, @@ -1467,6 +1481,20 @@ export const vertical = [ block: false, hidden: false, }, + { + type: 'tab-label_close', + tag: 'label', + map: null, + nesting: -1, + level: 0, + children: null, + content: '', + markup: '', + info: '', + meta: null, + block: false, + hidden: false, + }, { type: 'tab_close', tag: 'div', @@ -1724,7 +1752,7 @@ export const vertical = [ hidden: false, }, { - type: 'tab_open', + type: 'tab-input', tag: 'input', map: null, nesting: 0, @@ -1738,7 +1766,7 @@ export const vertical = [ hidden: false, }, { - type: 'label_open', + type: 'tab-label_open', tag: 'label', map: null, nesting: 1, @@ -1781,6 +1809,20 @@ export const vertical = [ block: false, hidden: false, }, + { + type: 'tab-label_close', + tag: 'label', + map: null, + nesting: -1, + level: 0, + children: null, + content: '', + markup: '', + info: '', + meta: null, + block: false, + hidden: false, + }, { type: 'tab_close', tag: 'div',