Skip to content

Commit 30febc3

Browse files
SebastienTob0t
authored andcommitted
Add the possibility to set card width to full.
1 parent d6c6ce2 commit 30febc3

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/MicrosoftTeamsAdaptiveCard.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ public function to(?string $webhookUrl): self
8282
return $this;
8383
}
8484

85+
/**
86+
* Sets the card to take the full width
87+
*
88+
* @return MicrosoftTeamsAdaptiveCard $this
89+
*/
90+
public function fullWidth(): self
91+
{
92+
$this->payload['attachments'][0]['content']['msteams']['width'] = 'Full';
93+
94+
return $this;
95+
}
96+
8597
/**
8698
* Get webhook url.
8799
*

tests/MicrosoftTeamsAdaptiveCardTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,4 +328,17 @@ public function actions_can_be_set(): void
328328

329329
$this->assertEquals($expectedPayload, $card->toArray());
330330
}
331+
332+
/** @test */
333+
public function full_width_can_be_set(): void
334+
{
335+
$card = new MicrosoftTeamsAdaptiveCard();
336+
337+
$card->fullWidth();
338+
339+
$payload = $card->toArray();
340+
$cardWidth = $payload['attachments'][0]['content']['msteams']['width'];
341+
342+
$this->assertEquals('Full', $cardWidth);
343+
}
331344
}

0 commit comments

Comments
 (0)