Skip to content

Commit 7e50b54

Browse files
committed
Mention spigot vs paper test toolkit
TODO: load-mock-commandapi page
1 parent 3eb3d19 commit 7e50b54

File tree

6 files changed

+179
-66
lines changed

6 files changed

+179
-66
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ yarn install
1414
yarn docs:build
1515
```
1616

17+
### View website changes locally
18+
19+
```bash
20+
yarn docs:dev
21+
```
22+
1723
### Verify reference code
1824

1925
```bash

docs/.vitepress/theme/preference/PreferenceSwitch.vue

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
import {VTIconChevronDown, VTSwitch} from '@vue/theme'
55
import {useData, useRoute} from 'vitepress'
66
import {onMounted, ref, Ref, watch} from 'vue'
7-
import {openPreference, openPreferenceKey, preferGroovyInGradle, preferGroovyInGradleKey, preferMaven, preferMavenKey, preferReobf, preferReobfKey,} from "./preference";
7+
import {
8+
openPreference, openPreferenceKey,
9+
preferPaper, preferPaperKey,
10+
preferGroovyInGradle, preferGroovyInGradleKey,
11+
preferMaven, preferMavenKey
12+
} from "./preference";
813
914
const {frontmatter} = useData();
1015
let preferencesToDisplay: Ref<string[]> = ref();
@@ -36,6 +41,12 @@ const restoreOutline = (e: Event) => {
3641
(e.target as HTMLElement).classList.remove('no-outline');
3742
};
3843
44+
const togglePaper = useToggleFn(
45+
preferPaperKey,
46+
preferPaper,
47+
'prefer-paper'
48+
)
49+
3950
const toggleMaven = useToggleFn(
4051
preferMavenKey,
4152
preferMaven,
@@ -48,12 +59,6 @@ const toggleGradleDsl = useToggleFn(
4859
'prefer-groovy'
4960
);
5061
51-
const toggleMapping = useToggleFn(
52-
preferReobfKey,
53-
preferReobf,
54-
'prefer-reobf'
55-
)
56-
5762
function useToggleFn(
5863
storageKey: string,
5964
state: Ref<boolean>,
@@ -77,9 +82,9 @@ function useToggleFn(
7782
refresh()
7883
7984
onMounted(() => {
85+
togglePaper(preferPaper.value);
8086
toggleMaven(preferMaven.value);
8187
toggleGradleDsl(preferGroovyInGradle.value);
82-
toggleMapping(preferReobf.value);
8388
});
8489
</script>
8590

@@ -102,6 +107,16 @@ onMounted(() => {
102107
:aria-hidden="!openPreference"
103108
>
104109
<div class="mobile-wrapper switches">
110+
<div v-if="preferencesToDisplay.includes('paper-spigot')" class="switch-container">
111+
<label class="paper-label prefer-label-left" @click="togglePaper(true)">Paper</label>
112+
<VTSwitch
113+
class="platform-switch"
114+
aria-label="prefer paper"
115+
:aria-checked="preferPaper"
116+
@click="togglePaper()"
117+
/>
118+
<label class="spigot-label prefer-label-right" @click="togglePaper(false)">Spigot</label>
119+
</div>
105120
<div v-if="preferencesToDisplay.includes('build-system')" class="switch-container">
106121
<label class="gradle-label prefer-label-left" @click="toggleMaven(false)">Gradle</label>
107122
<VTSwitch
@@ -122,16 +137,6 @@ onMounted(() => {
122137
/>
123138
<label class="groovy-label prefer-label-right" @click="toggleGradleDsl(true)">.gradle</label>
124139
</div>
125-
<div v-if="preferencesToDisplay.includes('paper-spigot')" class="switch-container">
126-
<label class="mojmap-label prefer-label-left" @click="toggleMapping(false)">Paper</label>
127-
<VTSwitch
128-
class="mapping-switch"
129-
aria-label="prefer reobf"
130-
:aria-checked="preferReobf"
131-
@click="toggleMapping()"
132-
/>
133-
<label class="reobf-label prefer-label-right" @click="toggleMapping(true)">Spigot</label>
134-
</div>
135140
</div>
136141
</div>
137142
<br class="hide-on-mobile" :hidden="openPreference"/>
@@ -270,57 +275,61 @@ onMounted(() => {
270275
</style>
271276

272277
<style>
278+
.paper,
273279
.maven,
274-
.groovy,
275-
.spigot {
280+
.groovy {
276281
display: none;
277282
}
278283
284+
.prefer-paper .spigot,
279285
.prefer-maven .gradle,
280-
.prefer-groovy .kts,
281-
.prefer-reobf .paper {
286+
.prefer-groovy .kts {
282287
display: none;
283288
}
284289
290+
.prefer-paper .paper,
285291
.prefer-maven .maven,
286-
.prefer-groovy .groovy,
287-
.prefer-reobf .spigot {
292+
.prefer-groovy .groovy {
288293
display: initial;
289294
}
290295
296+
.paper-label,
291297
.maven-label,
292298
.groovy-label,
293-
.reobf-label,
299+
.prefer-paper .spigot-label,
294300
.prefer-maven .gradle-label,
295-
.prefer-groovy .kts-label,
296-
.prefer-reobf .mojmap-label {
301+
.prefer-groovy .kts-label {
297302
color: var(--vt-c-text-3);
298303
}
299304
305+
.prefer-paper .paper-label,
300306
.prefer-maven .maven-label,
301-
.prefer-groovy .groovy-label,
302-
.prefer-reobf .reobf-label {
307+
.prefer-groovy .groovy-label {
303308
color: var(--vt-c-text-1);
304309
}
305310
306-
.prefer-maven .api-switch .vt-switch-check {
311+
.platform-switch .vt-switch-check {
307312
transform: translateX(18px);
308313
}
309314
310-
.prefer-groovy .dsl-switch .vt-switch-check {
315+
.prefer-paper .platform-switch .vt-switch-check {
316+
transform: translateX(0px);
317+
}
318+
319+
.prefer-maven .api-switch .vt-switch-check {
311320
transform: translateX(18px);
312321
}
313322
314-
.prefer-reobf .mapping-switch .vt-switch-check {
323+
.prefer-groovy .dsl-switch .vt-switch-check {
315324
transform: translateX(18px);
316325
}
317326
327+
.tip .paper,
328+
.tip .spigot,
318329
.tip .gradle,
319330
.tip .groovy,
320331
.tip .kts,
321-
.tip .maven,
322-
.tip .paper,
323-
.tip .spigot {
332+
.tip .maven {
324333
//color: var(--vt-c-text-code);
325334
/* transition: color 0.5s; */
326335
//font-weight: 600;

docs/.vitepress/theme/preference/preference.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ function getBoolean(key: string, defaultValue: boolean) {
1212
export const openPreferenceKey = 'command-api-docs-prefer-open-preference'
1313
export const openPreference = ref(getBoolean(openPreferenceKey, true))
1414

15+
export const preferPaperKey = 'command-api-docs-prefer-paper'
16+
export const preferPaper = ref(getBoolean(preferPaperKey, true))
17+
1518
export const preferMavenKey = 'command-api-docs-prefer-maven'
1619
export const preferMaven = ref(getBoolean(preferMavenKey, false))
1720

1821
export const preferGroovyInGradleKey = 'command-api-docs-prefer-groovy-dsl-in-gradle'
19-
export const preferGroovyInGradle = ref(getBoolean(preferGroovyInGradleKey, false))
20-
21-
export const preferReobfKey = 'command-api-docs-prefer-mojmap'
22-
export const preferReobf = ref(getBoolean(preferReobfKey, false))
22+
export const preferGroovyInGradle = ref(getBoolean(preferGroovyInGradleKey, false))

docs/en/test/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors:
66

77
# Testing Commands
88

9-
When developing large projects, it is good practice to add automated tests for your code. This section of the documentation describes how to use the `commandapi-bukkit-test-toolkit` dependency along with [MockBukkit](https://github.com/MockBukkit/MockBukkit) and [JUnit](https://junit.org/junit5/) to test the usage of commands registered with the CommandAPI.
9+
When developing large projects, it is good practice to add automated tests for your code. This section of the documentation describes how to use the `commandapi-spigot-test-toolkit`/`commandapi-paper-test-toolkit` dependency along with [MockBukkit](https://github.com/MockBukkit/MockBukkit) and [JUnit](https://junit.org/junit5/) to test the usage of commands registered with the CommandAPI.
1010

1111
For a big-picture view, you can find example projects that include automated tests in the [CommandAPI GitHub repository](https://github.com/CommandAPI/CommandAPI/tree/master/examples).
1212

0 commit comments

Comments
 (0)