|
|
|
@ -150,78 +150,6 @@ namespace Avalonia.Base.UnitTests.Styling |
|
|
|
Assert.False(sink.Active); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact(Skip = "Template selectors a the end of nesting parent selectors currently broken")] |
|
|
|
public void Template_Nesting_OfType_Matches() |
|
|
|
{ |
|
|
|
var control = new Control1 { Classes = { "foo" } }; |
|
|
|
var button = new Button |
|
|
|
{ |
|
|
|
Template = new FuncControlTemplate((x, _) => control), |
|
|
|
}; |
|
|
|
|
|
|
|
button.ApplyTemplate(); |
|
|
|
|
|
|
|
Style nested; |
|
|
|
var parent = new Style(x => x.OfType<Button>().Template()) |
|
|
|
{ |
|
|
|
Children = |
|
|
|
{ |
|
|
|
(nested = new Style(x => x.Nesting().OfType<Control1>())), |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var match = nested.Selector.Match(control, parent); |
|
|
|
Assert.Equal(SelectorMatchResult.AlwaysThisInstance, match.Result); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Template_Nesting_OfType_Class_Matches() |
|
|
|
{ |
|
|
|
var control = new Control1 { Classes = { "foo" } }; |
|
|
|
var button = new Button |
|
|
|
{ |
|
|
|
Template = new FuncControlTemplate((x, _) => control), |
|
|
|
}; |
|
|
|
|
|
|
|
button.ApplyTemplate(); |
|
|
|
|
|
|
|
Style nested; |
|
|
|
var parent = new Style(x => x.OfType<Button>().Template()) |
|
|
|
{ |
|
|
|
Children = |
|
|
|
{ |
|
|
|
(nested = new Style(x => x.Nesting().OfType<Control1>().Class("foo"))), |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var match = nested.Selector.Match(control, parent); |
|
|
|
Assert.Equal(SelectorMatchResult.Sometimes, match.Result); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact(Skip = "Template selectors a the end of nesting parent selectors currently broken")] |
|
|
|
public void Class_Template_Nesting_OfType_Matches() |
|
|
|
{ |
|
|
|
var control = new Control1 { Classes = { "foo" } }; |
|
|
|
var button = new Button |
|
|
|
{ |
|
|
|
Template = new FuncControlTemplate((x, _) => control), |
|
|
|
}; |
|
|
|
|
|
|
|
button.ApplyTemplate(); |
|
|
|
|
|
|
|
Style nested; |
|
|
|
var parent = new Style(x => x.OfType<Button>().Class("bar").Template()) |
|
|
|
{ |
|
|
|
Children = |
|
|
|
{ |
|
|
|
(nested = new Style(x => x.Nesting().OfType<Control1>())), |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var match = nested.Selector.Match(control, parent); |
|
|
|
Assert.Equal(SelectorMatchResult.Sometimes, match.Result); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Or_Nesting_Class_Matches() |
|
|
|
{ |
|
|
|
|