mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 09:49:08 +02:00
fcl-css: test inline style
This commit is contained in:
parent
02f41731eb
commit
d4a7431938
@ -319,8 +319,7 @@ Var
|
|||||||
aEl : TCSSElement;
|
aEl : TCSSElement;
|
||||||
Terms : TCSSTokens;
|
Terms : TCSSTokens;
|
||||||
begin
|
begin
|
||||||
Terms:=[ctkEOF];
|
Terms:=[ctkEOF,aStopOn];
|
||||||
Include(Terms,aStopOn);
|
|
||||||
aList:=TCSSCompoundElement(CreateElement(TCSSCompoundElement));
|
aList:=TCSSCompoundElement(CreateElement(TCSSCompoundElement));
|
||||||
Try
|
Try
|
||||||
While not (CurrentToken in Terms) do
|
While not (CurrentToken in Terms) do
|
||||||
@ -346,7 +345,6 @@ begin
|
|||||||
Result:=ParseRuleList;
|
Result:=ParseRuleList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TCSSParser.GetNextToken: TCSSToken;
|
function TCSSParser.GetNextToken: TCSSToken;
|
||||||
begin
|
begin
|
||||||
FPrevious:=FCurrent;
|
FPrevious:=FCurrent;
|
||||||
|
@ -317,6 +317,9 @@ var
|
|||||||
begin
|
begin
|
||||||
if El=nil then exit;
|
if El=nil then exit;
|
||||||
C:=El.ClassType;
|
C:=El.ClassType;
|
||||||
|
{$IFDEF VerboseCSSResolver}
|
||||||
|
//writeln('TCSSResolver.ComputeElement ',GetCSSPath(El));
|
||||||
|
{$ENDIF}
|
||||||
if C=TCSSCompoundElement then
|
if C=TCSSCompoundElement then
|
||||||
begin
|
begin
|
||||||
Compound:=TCSSCompoundElement(El);
|
Compound:=TCSSCompoundElement(El);
|
||||||
|
@ -243,11 +243,13 @@ type
|
|||||||
// ToDo: :lang()
|
// ToDo: :lang()
|
||||||
|
|
||||||
// ToDo: inline style
|
// ToDo: inline style
|
||||||
|
procedure Test_InlineStyle;
|
||||||
|
|
||||||
// ToDo: specifity
|
// ToDo: specifity
|
||||||
|
|
||||||
// pseudo elements
|
// pseudo elements
|
||||||
|
|
||||||
|
// skipping for forward compatibility
|
||||||
// ToDo: invalid token in selector makes selector invalid
|
// ToDo: invalid token in selector makes selector invalid
|
||||||
|
|
||||||
end;
|
end;
|
||||||
@ -921,6 +923,24 @@ begin
|
|||||||
AssertEquals('Div2.Top','',Div2.Top);
|
AssertEquals('Div2.Top','',Div2.Top);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestCSSResolver.Test_InlineStyle;
|
||||||
|
var
|
||||||
|
Div1: TDemoDiv;
|
||||||
|
begin
|
||||||
|
Doc.Root:=TDemoNode.Create(nil);
|
||||||
|
|
||||||
|
Div1:=TDemoDiv.Create(Doc);
|
||||||
|
Div1.Parent:=Doc.Root;
|
||||||
|
Div1.Style:='left: 10px;';
|
||||||
|
|
||||||
|
Doc.Style:=LinesToStr([
|
||||||
|
'div { left: 6px; }',
|
||||||
|
'']);
|
||||||
|
Doc.ApplyStyle;
|
||||||
|
AssertEquals('Root.Left','',Doc.Root.Left);
|
||||||
|
AssertEquals('Div1.Left','10px',Div1.Left);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TDemoDiv }
|
{ TDemoDiv }
|
||||||
|
|
||||||
class function TDemoDiv.CSSTypeName: TCSSString;
|
class function TDemoDiv.CSSTypeName: TCSSString;
|
||||||
|
Loading…
Reference in New Issue
Block a user