Skip to content

Commit 948f246

Browse files
authored
applies_to: Show GA in "Planned" if technical preview exists (#1492)
* applies_to: Show GA in "Planned" if technical preview exists * Add test * Refactor * Also add beta into the condition
1 parent de35cd5 commit 948f246

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
case ProductLifecycle.GenerallyAvailable:
273273
if (TryGetRealVersion(applicability, out var version) && version > versioningSystem.Current)
274274
{
275-
badgeText = "Planned";
275+
badgeText = applications.Any(a => a.Lifecycle is ProductLifecycle.TechnicalPreview or ProductLifecycle.Beta) ? "GA planned" : "Planned";
276276
lifecycleTooltip = "We plan to add this functionality in a future update. Plans may change without notice.";
277277
lifecycleClass = "planned";
278278
}

tests/authoring/Inline/AppliesToRole.fs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,44 @@ type ``parses multiple applies_to in one line`` () =
121121
Ece=AppliesCollection.op_Explicit "removed"
122122
)
123123
))
124+
125+
type ``render 'GA Planned' if preview exists alongside ga`` () =
126+
static let markdown = Setup.Markdown """
127+
128+
This is an inline {applies_to}`stack: preview 9.0, ga 9.1` element.
129+
"""
130+
131+
[<Fact>]
132+
let ``parses to AppliesDirective`` () =
133+
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
134+
test <@ directives.Length = 1 @>
135+
directives |> appliesToDirective (ApplicableTo(
136+
Stack=AppliesCollection.op_Explicit "preview 9.0, ga 9.1"
137+
))
138+
139+
[<Fact>]
140+
let ``validate HTML: generates link and alt attr`` () =
141+
markdown |> convertsToHtml """
142+
<p>This is an inline
143+
<span class="applies applies-inline">
144+
<span class="applicable-info">
145+
<span class="applicable-name" data-tippy-content="Part of the versioned Elastic Stack
146+
147+
Available in ECH, ECE, ECK, and self-managed deployments, unless otherwise stated">Stack</span>
148+
<span class="applicable-separator"></span>
149+
<span class="applicable-meta applicable-meta-planned" data-tippy-content="We plan to add this functionality in a future update. Plans may change without notice.">
150+
Planned
151+
</span>
152+
</span>
153+
<span class="applicable-info">
154+
<span class="applicable-name" data-tippy-content="Part of the versioned Elastic Stack
155+
156+
Available in ECH, ECE, ECK, and self-managed deployments, unless otherwise stated">Stack</span>
157+
<span class="applicable-separator"></span>
158+
<span class="applicable-meta applicable-meta-planned" data-tippy-content="We plan to add this functionality in a future update. Plans may change without notice.">
159+
GA planned
160+
</span>
161+
</span>
162+
</span>
163+
element.</p>
164+
"""

0 commit comments

Comments
 (0)