mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[json] Extract schemas with shorthand into TestSchemas
(cherry picked from commit 041011dd7b9e2679f300621382bffea71c0bf190) IJ-CR-158309 GitOrigin-RevId: 9f54ea230fabff872f23d64234f99b69fd6f35b1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
40d6eeccca
commit
733799c11e
@@ -86,4 +86,70 @@ object TestSchemas {
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
val settingWithEnabledShorthand
|
||||
get() = assertThatSchema("""
|
||||
{
|
||||
"properties": {
|
||||
"setting": {
|
||||
"anyOf": [
|
||||
{
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"enum": ["enabled"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
.withConfiguration(
|
||||
buildNestedCompletionsTree {
|
||||
open("setting")
|
||||
}
|
||||
)
|
||||
|
||||
val settingWithEnabledShorthandAndCustomization
|
||||
get() = assertThatSchema("""
|
||||
{
|
||||
"properties": {
|
||||
"setting": {
|
||||
"anyOf": [
|
||||
{
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"customization": {
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"enum": ["enabled"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
.withConfiguration(
|
||||
buildNestedCompletionsTree {
|
||||
open("setting") {
|
||||
open("customization")
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.jetbrains.jsonSchema.impl
|
||||
|
||||
import com.intellij.openapi.application.ex.PathManagerEx
|
||||
import com.jetbrains.jsonSchema.impl.TestSchemas.open1ThenOpen2Then3Schema
|
||||
import com.jetbrains.jsonSchema.impl.TestSchemas.settingWithEnabledShorthand
|
||||
import com.jetbrains.jsonSchema.impl.TestSchemas.settingWithEnabledShorthandAndCustomization
|
||||
import com.jetbrains.jsonSchema.impl.nestedCompletions.buildNestedCompletionsTree
|
||||
import org.intellij.lang.annotations.Language
|
||||
import java.io.File
|
||||
@@ -350,34 +352,7 @@ class JsonBySchemaHeavyNestedCompletionTest : JsonBySchemaHeavyCompletionTestBas
|
||||
fun `test nested completion leads to expanding - single level nestedness`() {
|
||||
addShorthandValueHandlerForEnabledField(testRootDisposable)
|
||||
|
||||
assertThatSchema("""
|
||||
{
|
||||
"properties": {
|
||||
"setting": {
|
||||
"anyOf": [
|
||||
{
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"enum": ["enabled"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
.withConfiguration(
|
||||
buildNestedCompletionsTree {
|
||||
open("setting")
|
||||
}
|
||||
)
|
||||
settingWithEnabledShorthand
|
||||
.appliedToJsonFile("""
|
||||
{
|
||||
"setting": "enabled"
|
||||
@@ -397,40 +372,7 @@ class JsonBySchemaHeavyNestedCompletionTest : JsonBySchemaHeavyCompletionTestBas
|
||||
fun `test nested completion leads to expanding - multiple level nestedness`() {
|
||||
addShorthandValueHandlerForEnabledField(testRootDisposable)
|
||||
|
||||
assertThatSchema("""
|
||||
{
|
||||
"properties": {
|
||||
"setting": {
|
||||
"anyOf": [
|
||||
{
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"customization": {
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"enum": ["enabled"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
.withConfiguration(
|
||||
buildNestedCompletionsTree {
|
||||
open("setting") {
|
||||
open("customization")
|
||||
}
|
||||
}
|
||||
)
|
||||
settingWithEnabledShorthandAndCustomization
|
||||
.appliedToJsonFile("""
|
||||
{
|
||||
"setting": "enabled"
|
||||
|
||||
@@ -4,6 +4,8 @@ package org.jetbrains.yaml.schema
|
||||
import com.intellij.openapi.application.ex.PathManagerEx
|
||||
import com.jetbrains.jsonSchema.impl.*
|
||||
import com.jetbrains.jsonSchema.impl.TestSchemas.open1ThenOpen2Then3Schema
|
||||
import com.jetbrains.jsonSchema.impl.TestSchemas.settingWithEnabledShorthand
|
||||
import com.jetbrains.jsonSchema.impl.TestSchemas.settingWithEnabledShorthandAndCustomization
|
||||
import com.jetbrains.jsonSchema.impl.nestedCompletions.buildNestedCompletionsTree
|
||||
import org.intellij.lang.annotations.Language
|
||||
import java.io.File
|
||||
@@ -265,34 +267,7 @@ class YamlByJsonSchemaHeavyNestedCompletionTest : JsonBySchemaHeavyCompletionTes
|
||||
fun `test nested completion leads to expanding - single level nestedness`() {
|
||||
addShorthandValueHandlerForEnabledField(testRootDisposable)
|
||||
|
||||
assertThatSchema("""
|
||||
{
|
||||
"properties": {
|
||||
"setting": {
|
||||
"anyOf": [
|
||||
{
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"enum": ["enabled"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
.withConfiguration(
|
||||
buildNestedCompletionsTree {
|
||||
open("setting")
|
||||
}
|
||||
)
|
||||
settingWithEnabledShorthand
|
||||
.appliedToYamlFile("""
|
||||
setting: enabled
|
||||
val<caret>
|
||||
@@ -307,40 +282,7 @@ class YamlByJsonSchemaHeavyNestedCompletionTest : JsonBySchemaHeavyCompletionTes
|
||||
fun `test nested completion leads to expanding - multiple level nestedness`() {
|
||||
addShorthandValueHandlerForEnabledField(testRootDisposable)
|
||||
|
||||
assertThatSchema("""
|
||||
{
|
||||
"properties": {
|
||||
"setting": {
|
||||
"anyOf": [
|
||||
{
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"customization": {
|
||||
"properties": {
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"enum": ["enabled"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
.withConfiguration(
|
||||
buildNestedCompletionsTree {
|
||||
open("setting") {
|
||||
open("customization")
|
||||
}
|
||||
}
|
||||
)
|
||||
settingWithEnabledShorthandAndCustomization
|
||||
.appliedToYamlFile("""
|
||||
setting: enabled
|
||||
val<caret>
|
||||
|
||||
Reference in New Issue
Block a user