Node tests are now more customizeable

This commit is contained in:
barsdeveloper
2023-04-01 22:32:22 +02:00
parent 82aaf5a9cb
commit 5de6952c48
5 changed files with 23 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import SVGIcon from "../../js/SVGIcon"
const tests = [
{
name: "==",
title: null,
value: String.raw`
Begin Object Class=/Script/BlueprintGraph.K2Node_PromotableOperator Name="K2Node_PromotableOperator_0"
bIsPureFunc=True
@@ -19,9 +20,7 @@ const tests = [
CustomProperties Pin (PinId=F34B818F900A4222BCC1DE111C2C7816,PinName="ReturnValue",PinToolTip="Return Value\nBoolean\n\nReturns whether brushes A and B are identical.",Direction="EGPD_Output",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
`,
color: Configuration.nodeColors.gray,
icon: SVGIcon.questionMark,
pins: 4,
pins: 3,
delegate: false,
development: false,
},

View File

@@ -13,13 +13,18 @@ export function generateNodeTest(nodeTest, getBlueprint) {
context(nodeTest.name, () => {
/** @type {NodeElement} */
let node
if (nodeTest.title === undefined) {
nodeTest.title = nodeTest.name
}
before(() => {
getBlueprint().removeGraphElement(...getBlueprint().getNodes())
Utility.paste(getBlueprint(), nodeTest.value)
node = getBlueprint().querySelector("ueb-node")
})
it("Has correct color", () => expect(node.entity.nodeColor()).to.be.deep.equal(nodeTest.color))
if (nodeTest.color) {
it("Has correct color", () => expect(node.entity.nodeColor()).to.be.deep.equal(nodeTest.color))
}
it("Has correct delegate", () => {
const delegate = node.querySelector('.ueb-node-top ueb-pin[data-type="delegate"]')
if (nodeTest.delegate) {
@@ -28,9 +33,13 @@ export function generateNodeTest(nodeTest, getBlueprint) {
expect(delegate).to.be.null
}
})
it("It's called " + nodeTest.name, () => expect(node.getNodeDisplayName()).to.be.equal(nodeTest.name))
if (nodeTest.title) {
it("Has title " + nodeTest.title, () => expect(node.getNodeDisplayName()).to.be.equal(nodeTest.title))
}
it("Has expected subtitle " + nodeTest.subtitle, () => expect(node.querySelector(".ueb-node-subtitle-text")?.innerText).to.be.equal(nodeTest.subtitle))
it("Has the correct icon", () => expect(node.entity.nodeIcon()).to.be.deep.equal(nodeTest.icon))
if (nodeTest.icon) {
it("Has the correct icon", () => expect(node.entity.nodeIcon()).to.be.deep.equal(nodeTest.icon))
}
it(`Has ${nodeTest.pins} pins`, () => expect(node.querySelectorAll("ueb-pin")).to.be.lengthOf(nodeTest.pins))
it("Expected development", () => expect(node.entity.isDevelopmentOnly()).equals(nodeTest.development))
it("Maintains the order of attributes", () => {

4
dist/ueblueprint.js vendored
View File

@@ -2124,6 +2124,9 @@ class PinEntity extends IEntity {
getDisplayName() {
let matchResult = null;
if (this.PinFriendlyName) {
return Utility.formatStringName(this.PinFriendlyName.toString())
}
if (
this.PinToolTip
// Match up until the first \n excluded or last character
@@ -7002,7 +7005,6 @@ class MinimalPinTemplate extends PinTemplate {
/**
* @typedef {import("../../element/PinElement").PinElementConstructor} PinElementConstructor
* @typedef {import("lit").PropertyValues} PropertyValues
* @typedef {import ("../../element/NodeElement.js").default} NodeElement
*/
class EventNodeTemplate extends NodeTemplate {

File diff suppressed because one or more lines are too long

View File

@@ -211,6 +211,9 @@ export default class PinEntity extends IEntity {
getDisplayName() {
let matchResult = null
if (this.PinFriendlyName) {
return Utility.formatStringName(this.PinFriendlyName.toString())
}
if (
this.PinToolTip
// Match up until the first \n excluded or last character