Comments (14)
<MatPortalHost></MatPortalHost>
maybe it has something to do with it, but I'm not sure how to enable it in BUnit.
from matblazor.
If MatBlazor needs a root component to be added in App.razor, then this might be what you need: https://bunit.dev/docs/providing-input/root-render-tree.html
from matblazor.
I think so, but I still can't make it work.
ctx.RenderTree.TryAdd<CascadingValue<MatPortalHost>>(parameters => parameters
.Add(p => p.Value, new MatPortalHost())
);
ctx.RenderTree.TryAdd<CascadingValue<MatDialogReference>>(parameters => parameters
.Add(p => p.Value, new MatDialogReference() { Service = new MatDialogService(new MatPortalService()) })
);
I tried these two together, alone, but it seems to have no effect.
from matblazor.
https://www.matblazor.com/DialogService
from matblazor.
Did you try:
ctx.RenderTree.TryAdd<MatPortalHost>();
from matblazor.
System.ArgumentException : The MatBlazor.MatPortalHost does not have a ChildContent or Body parameter. Only components with one of these parameters can be added to the root render tree.
from matblazor.
Then MatPortalHost
doesn't provide a cascading value. So are you sure you need it?
You may need to add a service to Services though. Take a look at the docs for the component to figure out it's dependencies.
from matblazor.
[CascadingParameter]
public MatDialogReference DialogReference { get; set; }
is this necessary. Furthermore:
// in root Blazor app component - App.razor
<MatPortalHost></MatPortalHost>
from matblazor.
this is not necessarily a cascading father (because you have to put it in app.razor).
I don't even know if that's the problem, it was just a possibility.
await cut.Instance.DialogReference.Service.OpenAsync(typeof(ChangeDialog), new MatDialogOptions() { Attributes = att });
I know it stops on that line. does not give error or anything.
from matblazor.
<MatPortalHost></MatPortalHost>
how can i declare this like it was in app.razor?
because this RenderTree you mentioned as far as I understand only registers parent components, not necessarily something that is in the app.
I think that's what's missing for me to be able to correctly register the services.
from matblazor.
when I run that last line of code, the system crashes.
To get more help, you might want to share what the exception message is.
from matblazor.
there is no error message. the execution just stops.
from matblazor.
there is no error message. the execution just stops.
So the system doesn't crash as you wrote before, the test completes without an error?
I don't know how the MadDialog works, but my guess is that it calls triggers something in a other component, perhaps in MatPortalHost, and that shows the dialog.
So the question is. Why would you want to test the internal dialog feature of MadBlazor?
Why not just render the content you want to show in the dialog and trust that the dialog itself works correctly.
Sorry, it's super hard to help any more. I'm not a MadBlazor dev, so don't know how it works.
from matblazor.
I don't know what the word crash means exactly.
but the execution stops, doesn't finish. if you debug the method, debugging will stop at that line, and not continue. as if there was an internal error, but this exception doesn't come back to you, so you don't know what's going on.
I use this functionality to open a popup a lot, so my test has to respect that, to be as close as possible to an interacting user.
from matblazor.
Related Issues (20)
- How to Disable Mattab Click
- IMatDialogService doesnt work with static instance
- Treeview - not rendering correctly HOT 5
- MatSelectItem - affecting the surrounding environment
- Elements of the MatPortalHost are not themed by a MatThemeProvider
- MatFileUpload (Missing "Attach_file" icon)
- Enable Dark Theme - Documentations? HOT 3
- ProgressCircle renders incorrectly
- MatBlazor DatePicker disabled doesn't disable the calendar button
- Deleting Element in MatList doesnt delete MatMenu reference
- SelectValue When Scrolling while expanded dropdown doesn't stay at input HOT 1
- TreeView: Performance/rendering improvement for big trees with many nodes
- MudTable does not render correctly when using iPhone SE
- MatTextfield - autocomplete off not working while Type is password
- MatAutocompleteList - CustomStringSelector not working with default value (possible bug)
- HowTo Translate the datepicker ? HOT 1
- MatSelectItem does not update selected value HOT 1
- Floating label by default
- how to call function after toast hide
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matblazor.