tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

fontSize.html (2176B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <div id='container'>
      5    <div id='element'></div>
      6 </div>
      7 <script>
      8 
      9 var container = document.getElementById('container');
     10 var element = document.getElementById('element');
     11 
     12 test(function() {
     13    var keyframes = [
     14        {fontSize: 'larger'},
     15        {fontSize: 'larger'}
     16    ];
     17 
     18    container.style.fontSize = 'small';
     19    var player = element.animate(keyframes, 10);
     20    player.pause();
     21    player.currentTime = 5;
     22    fontSize = getComputedStyle(element).fontSize;
     23    container.style.fontSize = 'medium';
     24    assert_not_equals(getComputedStyle(element).fontSize, fontSize);
     25 }, 'Relative font size larger responsive to style changes');
     26 
     27 test(function() {
     28    var keyframes = [
     29        {fontSize: 'smaller'},
     30        {fontSize: 'smaller'}
     31    ];
     32 
     33    container.style.fontSize = 'large';
     34    var player = element.animate(keyframes, 10);
     35    player.pause();
     36    player.currentTime = 5;
     37    fontSize = getComputedStyle(element).fontSize;
     38    container.style.fontSize = 'medium';
     39    assert_not_equals(getComputedStyle(element).fontSize, fontSize);
     40 }, 'Relative font size smaller responsive to style changes');
     41 
     42 test(function() {
     43    var keyframes = [
     44        {fontSize: 'medium'},
     45        {fontSize: 'medium'}
     46    ];
     47 
     48    container.style.fontFamily = 'cursive';
     49    var player = element.animate(keyframes, 10);
     50    player.pause();
     51    player.currentTime = 5;
     52    fontSize = getComputedStyle(element).fontSize;
     53    container.style.fontFamily = 'monospace';
     54    assert_not_equals(getComputedStyle(element).fontSize, fontSize);
     55 }, 'Font size medium responsive to style changes');
     56 
     57 test(function() {
     58    var keyframes = [
     59        {fontSize: 'initial'},
     60        {fontSize: 'initial'}
     61    ];
     62 
     63    container.style.fontFamily = 'monospace';
     64    var player = element.animate(keyframes, 10);
     65    player.pause();
     66    player.currentTime = 5;
     67    fontSize = getComputedStyle(element).fontSize;
     68    container.style.fontFamily = 'serif';
     69    assert_not_equals(getComputedStyle(element).fontSize, fontSize);
     70 }, 'Font size initial responsive to style changes');
     71 
     72 </script>