Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: flex-basis with percentage not working #1300

Merged
merged 10 commits into from
Apr 15, 2022
2 changes: 0 additions & 2 deletions bridge/foundation/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ void pipeMessageToInspector(JSGlobalContextRef ctx, const std::string message, c
};
#endif


void printLog(int32_t contextId, std::stringstream& stream, std::string level, void* ctx) {
MessageLevel _log_level = MessageLevel::Info;
switch (level[0]) {
Expand Down Expand Up @@ -128,7 +127,6 @@ void printLog(int32_t contextId, std::stringstream& stream, std::string level, v
if (kraken::getDartMethod()->onJsLog != nullptr) {
kraken::getDartMethod()->onJsLog(contextId, static_cast<int>(_log_level), stream.str().c_str());
}

}

} // namespace foundation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion integration_tests/specs/css/css-flexbox/flex-minimum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ describe('flex-minimum', () => {
(testFlexItemOverlappingGreen = createElement('img', {
id: 'test-flex-item-overlapping-green',
src:
'https://kraken.oss-cn-hangzhou.aliyuncs.com/images/200x200-green.png',
'assets/200x200-green.png',
style: {
'max-height': '100px',
'box-sizing': 'border-box',
Expand Down
169 changes: 169 additions & 0 deletions integration_tests/specs/css/css-flexbox/flex_basis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,173 @@ describe('flexbox flex-basis', () => {

await snapshot();
});

it('should work with px', async () => {
let div;
div = createElement(
'div',
{
style: {
background: 'blue',
height: '100px',
width: '200px',
display: 'flex',
},
},
[
createElement(
'span',
{
style: {
background: 'yellow',
width: '50px',
'max-width': '60px',
display: 'inline-block',
flexBasis: '0',
'box-sizing': 'border-box',
},
},
[createText(`one`)]
),
createElement(
'span',
{
style: {
background: 'pink',
width: '50px',
flexBasis: '40px',
},
},
[createText(`two`)]
),
createElement(
'span',
{
style: {
background: 'lightblue',
width: '50px',
flexBasis: '60px',
},
},
[createText(`three`)]
),
]
);
BODY.appendChild(div);
await snapshot();
});

it('should work with percentage', async () => {
let div;
div = createElement(
'div',
{
style: {
background: 'blue',
height: '100px',
width: '200px',
display: 'flex',
},
},
[
createElement(
'span',
{
style: {
background: 'yellow',
width: '50px',
'max-width': '60px',
display: 'inline-block',
flexBasis: '0%',
'box-sizing': 'border-box',
},
},
[createText(`one`)]
),
createElement(
'span',
{
style: {
background: 'pink',
width: '50px',
flexBasis: '20%',
},
},
[createText(`two`)]
),
createElement(
'span',
{
style: {
background: 'lightblue',
width: '50px',
flexBasis: '30%',
},
},
[createText(`three`)]
),
]
);
BODY.appendChild(div);

await snapshot();
});

it('should work with min and max size', async () => {
let div;
div = createElement(
'div',
{
style: {
background: 'blue',
height: '100px',
width: '200px',
display: 'flex',
},
},
[
createElement(
'span',
{
style: {
background: 'yellow',
width: '50px',
'max-width': '60px',
display: 'inline-block',
flexBasis: '0',
minWidth: '50px',
'box-sizing': 'border-box',
},
},
[createText(`one`)]
),
createElement(
'span',
{
style: {
background: 'pink',
width: '50px',
flexBasis: '50px',
},
},
[createText(`two`)]
),
createElement(
'span',
{
style: {
background: 'lightblue',
width: '50px',
flexBasis: '100px',
maxWidth: '50px',
},
},
[createText(`three`)]
),
]
);
BODY.appendChild(div);

await snapshot();
});
});
12 changes: 4 additions & 8 deletions integration_tests/specs/css/css-flexbox/flexbox_flex-0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1392,8 +1392,7 @@ describe('flexbox_flex-0', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('1-0', async () => {
it('1-0', async () => {
let div;
div = createElement(
'div',
Expand Down Expand Up @@ -2179,8 +2178,7 @@ describe('flexbox_flex-0', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('1-Npercent', async () => {
it('1-Npercent', async () => {
let div;
div = createElement(
'div',
Expand Down Expand Up @@ -2801,8 +2799,7 @@ describe('flexbox_flex-0', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('N-0', async () => {
it('N-0', async () => {
let div;
div = createElement(
'div',
Expand Down Expand Up @@ -3429,8 +3426,7 @@ describe('flexbox_flex-0', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('N-Npercent', async () => {
it('N-Npercent', async () => {
let div;
div = createElement(
'div',
Expand Down
22 changes: 7 additions & 15 deletions integration_tests/specs/css/css-flexbox/flexbox_flex-1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ describe('flexbox_flex-1', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('0-0', async () => {
it('0-0', async () => {
let div;
div = createElement(
'div',
Expand Down Expand Up @@ -702,8 +701,7 @@ describe('flexbox_flex-1', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('0-Npercent-shrink', async () => {
it('0-Npercent-shrink', async () => {
let div;
div = createElement(
'div',
Expand Down Expand Up @@ -782,8 +780,7 @@ describe('flexbox_flex-1', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('0-Npercent', async () => {
it('0-Npercent', async () => {
let div;
div = createElement(
'div',
Expand Down Expand Up @@ -1406,8 +1403,7 @@ describe('flexbox_flex-1', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('1-0', async () => {
it('1-0', async () => {
let div;
div = createElement(
'div',
Expand Down Expand Up @@ -2034,8 +2030,7 @@ describe('flexbox_flex-1', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('1-Npercent', async () => {
it('1-Npercent', async () => {
let div;
div = createElement(
'div',
Expand Down Expand Up @@ -2661,8 +2656,7 @@ describe('flexbox_flex-1', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('N-0', async () => {
it('N-0', async () => {
let div;
div = createElement(
'div',
Expand Down Expand Up @@ -2741,7 +2735,6 @@ describe('flexbox_flex-1', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
it('N-N-ref', async () => {
let div;
div = createElement(
Expand Down Expand Up @@ -3291,8 +3284,7 @@ describe('flexbox_flex-1', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('N-Npercent', async () => {
it('N-Npercent', async () => {
let div;
div = createElement(
'div',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ describe('flexbox_flex-basis', () => {
await snapshot();
});

// @TODO: Percentage of flex-basis not working.
xit('shrink', async () => {
it('shrink', async () => {
let div;
div = createElement(
'div',
Expand Down
Loading