File: flex.html

package info (click to toggle)
firefox-esr 140.4.0esr-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,539,276 kB
  • sloc: cpp: 7,381,286; javascript: 6,388,710; ansic: 3,710,139; python: 1,393,780; xml: 628,165; asm: 426,918; java: 184,004; sh: 65,742; makefile: 19,302; objc: 13,059; perl: 12,912; yacc: 4,583; cs: 3,846; pascal: 3,352; lex: 1,720; ruby: 1,226; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10
file content (75 lines) | stat: -rw-r--r-- 2,295 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!doctype html>
<title>button with flex/inline-flex</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
#inline-flex { display: inline-flex }
#flex { display: flex }
#ref > div { display: flex }

#flexstart {
  border: none;
  padding: 0;
  display: flex;
  align-items: flex-start;
  height: 3em;
}

#stretch {
  border: none;
  padding: 0;
  display: flex;
  align-items: stretch;
  height: 3em;
}

#no-align-items {
  border: none;
  padding: 0;
  display: flex;
  height: 3em;
}
</style>
<button id=inline-flex><div>1</div><div>2</div><div>3</div><div>4</div></button>
<button id=flex><div>1</div><div>2</div><div>3</div><div>4</div></button>
<button id=ref><div><div>1</div><div>2</div><div>3</div><div>4</div></div></button>

<div><button id="flexstart"><span id="flexstart-item">abc</span></button></div>

<div><button id="stretch"><span id="stretch-item">abc</span></button></div>
<div><button id="no-align-items"><span id="no-align-items-item">abc</span></button></div>
<script>
const ref = document.getElementById('ref');
const expectedWidth = ref.clientWidth;
const expectedHeight = ref.clientHeight;
for (const elm of [document.getElementById('inline-flex'),
                   document.getElementById('flex')]) {
  test(() => {
    // check that flex is supported
    const flexValue = elm.id;
    assert_equals(getComputedStyle(elm).display, flexValue, `${flexValue} is not supported`);
    const width = elm.clientWidth;
    const height = elm.clientHeight;
    assert_equals(width, expectedWidth, 'clientWidth');
    assert_equals(height, expectedHeight, 'clientHeight');
  }, elm.id);
}

// crbug.com/700029
test(() => {
  assert_equals(document.getElementById('flexstart').offsetTop,
    document.getElementById('flexstart-item').offsetTop);
}, 'align-items:flex-start should work');

// crbug.com/1004163
test(() => {
  assert_equals(document.getElementById('stretch').offsetHeight,
    document.getElementById('stretch-item').offsetHeight);
}, 'align-items:stretch should work');

// crbug.com/40681980
test(() => {
  assert_equals(document.getElementById('no-align-items').offsetHeight,
    document.getElementById('no-align-items-item').offsetHeight);
}, 'No align-items should work as stretch');
</script>