Skip to content

Commit

Permalink
[mac]Fixed bug with associated inputs in show card (#406)
Browse files Browse the repository at this point in the history
* Fixed bug with associated inputs in show card

* Added test json

* Updated pbxproj file
  • Loading branch information
mukuagar authored Dec 14, 2023
1 parent 6fd3b8a commit 136ff8e
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"type": "AdaptiveCard",
"$schema": "http:\/\/adaptivecards.io\/schemas\/adaptive-card.json",
"version": "1.3",
"body": [
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Submit",
"data": {
"wbm_command": "help"
},
"associatedInputs": "none"
},
{
"type": "Action.ShowCard",
"title": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Submit",
"data": {
"wbm_command": "help"
},
"associatedInputs": "none"
}
]
}
]
}
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
281415F429EEF6200042F0FC /* ACSTableRow.h in Headers */ = {isa = PBXBuildFile; fileRef = 281415EC29EEF61F0042F0FC /* ACSTableRow.h */; settings = {ATTRIBUTES = (Public, ); }; };
281415F529EEF6200042F0FC /* ACSTableCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 281415ED29EEF6200042F0FC /* ACSTableCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
281950432703141500B0D790 /* HostConfigUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 281950422703141500B0D790 /* HostConfigUtilsTests.swift */; };
283295702B299D3500979501 /* AdaptiveCardRendererTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2832956F2B299D3500979501 /* AdaptiveCardRendererTests.swift */; };
2871B11825DD20A30040AB27 /* FakeTextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2871B11725DD20A30040AB27 /* FakeTextInput.swift */; };
2871B11D25DD225C0040AB27 /* ACRMultilineTextView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2871B11C25DD225C0040AB27 /* ACRMultilineTextView.xib */; };
2871B12A25DD27F10040AB27 /* ACRMultilineInputTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2871B12925DD27F10040AB27 /* ACRMultilineInputTextView.swift */; };
Expand Down Expand Up @@ -1043,6 +1044,7 @@
281415EC29EEF61F0042F0FC /* ACSTableRow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ACSTableRow.h; sourceTree = "<group>"; };
281415ED29EEF6200042F0FC /* ACSTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ACSTableCell.h; sourceTree = "<group>"; };
281950422703141500B0D790 /* HostConfigUtilsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostConfigUtilsTests.swift; sourceTree = "<group>"; };
2832956F2B299D3500979501 /* AdaptiveCardRendererTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdaptiveCardRendererTests.swift; sourceTree = "<group>"; };
2871B11725DD20A30040AB27 /* FakeTextInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeTextInput.swift; sourceTree = "<group>"; };
2871B11C25DD225C0040AB27 /* ACRMultilineTextView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ACRMultilineTextView.xib; sourceTree = "<group>"; };
2871B12925DD27F10040AB27 /* ACRMultilineInputTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ACRMultilineInputTextView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1494,6 +1496,7 @@
08FFAC2C2608DB6B00296D62 /* ActionOpenURLRendererTests.swift */,
2982B3F62628933C00E7561C /* BaseCardElementRendererTests.swift */,
086D82DA26AA9E0800CD2D0D /* ActionToggleVisibilityRendererTests.swift */,
2832956F2B299D3500979501 /* AdaptiveCardRendererTests.swift */,
);
path = Renderers;
sourceTree = "<group>";
Expand Down Expand Up @@ -2766,6 +2769,7 @@
08352EA52695CFB300B544C3 /* FakeInternalId.swift in Sources */,
082E59AE2604E96E00741958 /* FakeAdaptiveCard.swift in Sources */,
81AFEA7626281B9400DD47E0 /* ACRNumericTextFieldTests.swift in Sources */,
283295702B299D3500979501 /* AdaptiveCardRendererTests.swift in Sources */,
8107117C26E208E5001A7BC2 /* ACRMultilineTextViewTests.swift in Sources */,
0801EDB425F78EB800D64C86 /* FakeColumnSet.swift in Sources */,
2871B15025DD4C4D0040AB27 /* TextInputRedererTest.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class AdaptiveCardRenderer {
logError("renderAdaptiveCard should return ACRView")
return NSView()
}
cardView.identifier = parent.identifier
cardView.parent = parent
return cardView
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// AdaptiveCardRendererTests.swift
// AdaptiveCardsTests
//
// Created by mukuagar on 13/12/23.
//

@testable import AdaptiveCards
import AdaptiveCards_bridge
import XCTest

class AdaptiveCardRendererTests: XCTestCase {
private var hostConfig: FakeHostConfig!
private var adaptiveCardRenderer: AdaptiveCardRenderer!
private var rootView: FakeRootView!

override func setUpWithError() throws {
try super.setUpWithError()
hostConfig = .make()
adaptiveCardRenderer = AdaptiveCardRenderer()
rootView = FakeRootView()
}

func testShowCardIdSameAsParent() {
let parentView = FakeRootView()
parentView.identifier = NSUserInterfaceItemIdentifier("test")
let fakeShowCard = FakeAdaptiveCard.make()
let showCardView = adaptiveCardRenderer.renderShowCard(fakeShowCard, with: hostConfig, parent: parentView, config: .default)
XCTAssertEqual(parentView.identifier, showCardView.identifier)
XCTAssertEqual(showCardView.identifier?.rawValue, "test")
}

}

0 comments on commit 136ff8e

Please sign in to comment.