Skip to content

Commit 9c5891e

Browse files
committed
Add test
1 parent 69eae10 commit 9c5891e

File tree

3 files changed

+170
-146
lines changed

3 files changed

+170
-146
lines changed

tests/authoring/Inline/AppliesToRole.fs

Lines changed: 5 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
module ``inline elements``.``applies_to role``
5+
module ``inline elements``.``kbd role``
66

77
open Elastic.Markdown.Myst.FrontMatter
88
open Elastic.Markdown.Myst.Roles.AppliesTo
@@ -11,154 +11,13 @@ open Xunit
1111
open authoring
1212
open authoring.MarkdownDocumentAssertions
1313

14-
type ``parses inline {applies_to} role`` () =
14+
type ``parses inline {kbd} role`` () =
1515
static let markdown = Setup.Markdown """
16-
17-
This is an inline {applies_to}`stack: preview 9.1` element.
16+
Press {kbd}`Ctrl` + {kbd}`S` to save.
1817
"""
1918

2019
[<Fact>]
21-
let ``parses to AppliesDirective`` () =
22-
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
23-
test <@ directives.Length = 1 @>
24-
directives |> appliesToDirective (ApplicableTo(
25-
Stack=AppliesCollection.op_Explicit "preview 9.1.0"
26-
))
27-
28-
[<Fact>]
29-
let ``validate HTML: generates link and alt attr`` () =
20+
let ``validate HTML`` () =
3021
markdown |> convertsToHtml """
31-
<p>This is an inline
32-
<span class="applies applies-inline">
33-
<span class="applicable-info" data-tippy-content="We plan to add this functionality in a future Elastic&nbsp;Stack update. Subject to change.
34-
35-
This functionality may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.">
36-
<span class="applicable-name">Stack</span>
37-
<span class="applicable-separator"></span>
38-
<span class="applicable-meta applicable-meta-preview">
39-
Planned
40-
</span>
41-
</span>
42-
</span>
43-
element.</p>
44-
"""
45-
46-
47-
type ``parses nested ess moniker`` () =
48-
static let markdown = Setup.Markdown """
49-
50-
This is an inline {applies_to}`ess: preview 9.1` element.
51-
"""
52-
53-
[<Fact>]
54-
let ``parses to AppliesDirective`` () =
55-
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
56-
test <@ directives.Length = 1 @>
57-
directives |> appliesToDirective (ApplicableTo(
58-
Deployment=DeploymentApplicability(
59-
Ess=AppliesCollection.op_Explicit "preview 9.1.0"
60-
)
61-
))
62-
63-
type ``parses {preview} shortcut`` () =
64-
static let markdown = Setup.Markdown """
65-
66-
This is an inline {preview}`9.1` element.
67-
"""
68-
69-
[<Fact>]
70-
let ``parses to AppliesDirective`` () =
71-
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
72-
test <@ directives.Length = 1 @>
73-
directives |> appliesToDirective (ApplicableTo(
74-
Product=AppliesCollection.op_Explicit "preview 9.1.0"
75-
))
76-
77-
78-
type ``parses applies to without version in table`` () =
79-
static let markdown = Setup.Markdown """
80-
| col1 | col2 |
81-
|------|------------------------------|
82-
| test | {applies_to}`ece: removed` |
83-
"""
84-
85-
[<Fact>]
86-
let ``parses to AppliesDirective`` () =
87-
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
88-
test <@ directives.Length = 1 @>
89-
directives |> appliesToDirective (ApplicableTo(
90-
Deployment=DeploymentApplicability(
91-
Ece=AppliesCollection.op_Explicit "removed"
92-
)
93-
))
94-
95-
type ``parses applies to with text afterwards`` () =
96-
static let markdown = Setup.Markdown """
97-
{applies_to}`ece: removed` hello world
98-
"""
99-
100-
[<Fact>]
101-
let ``parses to AppliesDirective`` () =
102-
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
103-
test <@ directives.Length = 1 @>
104-
directives |> appliesToDirective (ApplicableTo(
105-
Deployment=DeploymentApplicability(
106-
Ece=AppliesCollection.op_Explicit "removed"
107-
)
108-
))
109-
110-
type ``parses multiple applies_to in one line`` () =
111-
static let markdown = Setup.Markdown """
112-
{applies_to}`ece: removed` {applies_to}`ece: removed`
113-
"""
114-
115-
[<Fact>]
116-
let ``parses to AppliesDirective`` () =
117-
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
118-
test <@ directives.Length = 2 @>
119-
directives |> appliesToDirective (ApplicableTo(
120-
Deployment=DeploymentApplicability(
121-
Ece=AppliesCollection.op_Explicit "removed"
122-
)
123-
))
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" data-tippy-content="We plan to add this functionality in a future Elastic&nbsp;Stack update. Subject to change.
145-
146-
This functionality may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.">
147-
<span class="applicable-name">Stack</span>
148-
<span class="applicable-separator"></span>
149-
<span class="applicable-meta applicable-meta-preview">
150-
Planned
151-
</span>
152-
</span>
153-
<span class="applicable-info" data-tippy-content="We plan to add this functionality in a future Elastic&nbsp;Stack update. Subject to change.
154-
155-
If this functionality is unavailable or behaves differently when deployed on ECH, ECE, ECK, or a self-managed installation, it will be indicated on the page.">
156-
<span class="applicable-name">Stack</span>
157-
<span class="applicable-separator"></span>
158-
<span class="applicable-meta applicable-meta-ga">
159-
GA planned
160-
</span>
161-
</span>
162-
</span>
163-
element.</p>
22+
<p>Press <kbd>Ctrl</kbd> + <kbd>S</kbd> to save.</p>
16423
"""

tests/authoring/Inline/KbdRole.fs

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
module ``inline elements``.``applies_to role``
6+
7+
open Elastic.Markdown.Myst.FrontMatter
8+
open Elastic.Markdown.Myst.Roles.AppliesTo
9+
open Swensen.Unquote
10+
open Xunit
11+
open authoring
12+
open authoring.MarkdownDocumentAssertions
13+
14+
type ``parses inline {applies_to} role`` () =
15+
static let markdown = Setup.Markdown """
16+
17+
This is an inline {applies_to}`stack: preview 9.1` element.
18+
"""
19+
20+
[<Fact>]
21+
let ``parses to AppliesDirective`` () =
22+
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
23+
test <@ directives.Length = 1 @>
24+
directives |> appliesToDirective (ApplicableTo(
25+
Stack=AppliesCollection.op_Explicit "preview 9.1.0"
26+
))
27+
28+
[<Fact>]
29+
let ``validate HTML: generates link and alt attr`` () =
30+
markdown |> convertsToHtml """
31+
<p>This is an inline
32+
<span class="applies applies-inline">
33+
<span class="applicable-info" data-tippy-content="We plan to add this functionality in a future Elastic&nbsp;Stack update. Subject to change.
34+
35+
This functionality may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.">
36+
<span class="applicable-name">Stack</span>
37+
<span class="applicable-separator"></span>
38+
<span class="applicable-meta applicable-meta-preview">
39+
Planned
40+
</span>
41+
</span>
42+
</span>
43+
element.</p>
44+
"""
45+
46+
47+
type ``parses nested ess moniker`` () =
48+
static let markdown = Setup.Markdown """
49+
50+
This is an inline {applies_to}`ess: preview 9.1` element.
51+
"""
52+
53+
[<Fact>]
54+
let ``parses to AppliesDirective`` () =
55+
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
56+
test <@ directives.Length = 1 @>
57+
directives |> appliesToDirective (ApplicableTo(
58+
Deployment=DeploymentApplicability(
59+
Ess=AppliesCollection.op_Explicit "preview 9.1.0"
60+
)
61+
))
62+
63+
type ``parses {preview} shortcut`` () =
64+
static let markdown = Setup.Markdown """
65+
66+
This is an inline {preview}`9.1` element.
67+
"""
68+
69+
[<Fact>]
70+
let ``parses to AppliesDirective`` () =
71+
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
72+
test <@ directives.Length = 1 @>
73+
directives |> appliesToDirective (ApplicableTo(
74+
Product=AppliesCollection.op_Explicit "preview 9.1.0"
75+
))
76+
77+
78+
type ``parses applies to without version in table`` () =
79+
static let markdown = Setup.Markdown """
80+
| col1 | col2 |
81+
|------|------------------------------|
82+
| test | {applies_to}`ece: removed` |
83+
"""
84+
85+
[<Fact>]
86+
let ``parses to AppliesDirective`` () =
87+
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
88+
test <@ directives.Length = 1 @>
89+
directives |> appliesToDirective (ApplicableTo(
90+
Deployment=DeploymentApplicability(
91+
Ece=AppliesCollection.op_Explicit "removed"
92+
)
93+
))
94+
95+
type ``parses applies to with text afterwards`` () =
96+
static let markdown = Setup.Markdown """
97+
{applies_to}`ece: removed` hello world
98+
"""
99+
100+
[<Fact>]
101+
let ``parses to AppliesDirective`` () =
102+
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
103+
test <@ directives.Length = 1 @>
104+
directives |> appliesToDirective (ApplicableTo(
105+
Deployment=DeploymentApplicability(
106+
Ece=AppliesCollection.op_Explicit "removed"
107+
)
108+
))
109+
110+
type ``parses multiple applies_to in one line`` () =
111+
static let markdown = Setup.Markdown """
112+
{applies_to}`ece: removed` {applies_to}`ece: removed`
113+
"""
114+
115+
[<Fact>]
116+
let ``parses to AppliesDirective`` () =
117+
let directives = markdown |> converts "index.md" |> parses<AppliesToRole>
118+
test <@ directives.Length = 2 @>
119+
directives |> appliesToDirective (ApplicableTo(
120+
Deployment=DeploymentApplicability(
121+
Ece=AppliesCollection.op_Explicit "removed"
122+
)
123+
))
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" data-tippy-content="We plan to add this functionality in a future Elastic&nbsp;Stack update. Subject to change.
145+
146+
This functionality may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.">
147+
<span class="applicable-name">Stack</span>
148+
<span class="applicable-separator"></span>
149+
<span class="applicable-meta applicable-meta-preview">
150+
Planned
151+
</span>
152+
</span>
153+
<span class="applicable-info" data-tippy-content="We plan to add this functionality in a future Elastic&nbsp;Stack update. Subject to change.
154+
155+
If this functionality is unavailable or behaves differently when deployed on ECH, ECE, ECK, or a self-managed installation, it will be indicated on the page.">
156+
<span class="applicable-name">Stack</span>
157+
<span class="applicable-separator"></span>
158+
<span class="applicable-meta applicable-meta-ga">
159+
GA planned
160+
</span>
161+
</span>
162+
</span>
163+
element.</p>
164+
"""

tests/authoring/authoring.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<Compile Include="Inline\InlineAnchors.fs"/>
4444
<Compile Include="Inline\Comments.fs"/>
4545
<Compile Include="Inline\AppliesToRole.fs" />
46+
<Compile Include="Inline\KbdRole.fs" />
4647
<Compile Include="Inline\InlineAppliesTo.fs" />
4748
<Compile Include="Inline\InlineLinks.fs" />
4849
<Compile Include="Inline\CrossLinks.fs" />

0 commit comments

Comments
 (0)