Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork99
-
Hi. reason that I am asking is that I use Playwright extensively for testing, and the stated best practice is to give each component an attribute 'data-testid' , eg. data-testid="MenuButtonWelcome". Is it acceptable to just add such a tag into a component , eg: <Button data-testid="MenuButtonWelcome" Color="ButtonColor.Secondary" ..... Or must one use the AdditionalAttributes parameter? If so, must one declare a Dictionary variable in the code section, or can one just create the Dictionary ' in place' ? i.e. AdditionalAttributes="@(new Dictionary<string,object>(){{"data-testid", "MenuButtonWelcome"}} )" Any help or guidance appreciated . TIA |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 4 comments 1 reply
-
@curtic00 Thank you for usingBlazorBootstrap. Here is the example: <ButtonColor="ButtonColor.Primary"AdditionalAttributes="@additionalAttributes"> Primary </Button>@code{Dictionary<string,object>additionalAttributes=new() { {"data-id","9HFI94LD580" } };} ![]() |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks Vikram.Do you have a list of your controls that implements the AdditionalAttributes parameter as I have been unable to find any documentation on it?TIA, regards Charlie Charlie Curtis Worthing, West SussexBN133AB.MCSD, MCSA, MCRDBA, Azure administratorMobile: 0777 254 5516LinkedIn: https://uk.linkedin.com/in/charlieecharlieOn 13 Aug 2025, at 17:20, Vikram Reddy ***@***.***> wrote:@curtic00 Thank you for using BlazorBootstrap.Here is the example:<Button Color="ButtonColor.Primary" ***@***.***"> Primary </Button>@code{ Dictionary<string, object> additionalAttributes = new() { { "data-id", "9HFI94LD580" } };}image.png (view on web)—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***> |
BetaWas this translation helpful?Give feedback.
All reactions
-
@curtic00AdditionalAttributes is a default parameter for all components. We will update our documentation. |
BetaWas this translation helpful?Give feedback.
All reactions
-
👍👍Charlie Curtis Worthing, West SussexBN133AB.MCSD, MCSA, MCRDBA, Azure administratorMobile: 0777 254 5516LinkedIn: https://uk.linkedin.com/in/charlieecharlieOn 14 Aug 2025, at 13:20, Vikram Reddy ***@***.***> wrote:@curtic00 AdditionalAttributes is a default parameter for all components. We will update our documentation.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***> |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hi VikramI suppose that it would be a lot of work to create a new parameter in your base component and have it bubble up to all of the parent components?Reason that I ask is that I use playwright for all of my integration testing, and the ‘data-testid’ attribute is the Playwright recommended approach for testing.For example, I have nearly 140 instances of data-testid on one page…..RegardsCharlieFrom: Vikram Reddy ***@***.***>Sent: 14 August 2025 13:20To: vikramlearning/blazorbootstrap ***@***.***>Cc: curtic00 ***@***.***>; Mention ***@***.***>Subject: Re: [vikramlearning/blazorbootstrap] Additional Attributes (Discussion#1162)@curtic00 <https://github.com/curtic00> AdditionalAttributes is a default parameter for all components. We will update our documentation.—Reply to this email directly, view it on GitHub <#1162 (reply in thread)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AUSOJFSPDKB2C3E25GNIEZL3NR5HLAVCNFSM6AAAAACDN7RA76VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTIMJQGMZTGNI> .You are receiving this because you were mentioned.Message ID: ***@***.*** ***@***.***> > |
BetaWas this translation helpful?Give feedback.
