Make WordPress Core


Ignore:
Timestamp:
09/08/2018 04:19:40 AM (7 years ago)
Author:
adamsilverstein
Message:

Media: Improve display and accessibility of meta data in detail view.

  • Add a human_readable_duration function including tests.
  • Add 'pixels' after image width/height.
  • Add screen reader text for durations.

Props Presskopp, kiranpotphode, milindmore22, stormrockwell, afercia.
Fixes #39667.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions.php

    r43571 r43633  
    15191519        );
    15201520    }
     1521
     1522    /**
     1523     * Test the human_readable_duration function.
     1524     *
     1525     * @ticket 39667
     1526     * @dataProvider _datahuman_readable_duration()
     1527     *
     1528     * @param $input
     1529     * @param $expected
     1530     */
     1531    public function test_duration_format( $input, $expected ) {
     1532        $this->assertSame( $expected, human_readable_duration( $input ) );
     1533    }
     1534
     1535    public function _datahuman_readable_duration() {
     1536        return array(
     1537            array( array(), false ),
     1538            array( '30:00', '30 minutes, 0 seconds' ),
     1539            array( 'Batman Begins !', false ),
     1540            array( '', false ),
     1541            array( '-1', false ),
     1542            array( -1, false ),
     1543            array( 0, false ),
     1544            array( 1, false ),
     1545            array( '00', false ),
     1546            array( '00:00', '0 minutes, 0 seconds' ),
     1547            array( '00:00:00', '0 hours, 0 minutes, 0 seconds' ),
     1548            array( '10:30:34', '10 hours, 30 minutes, 34 seconds' ),
     1549            array( '00:30:34', '0 hours, 30 minutes, 34 seconds' ),
     1550            array( 'MM:30:00', false ),
     1551            array( '30:MM', false ),
     1552            array( 'MM:00', false ),
     1553            array( 'MM:MM', false ),
     1554            array( '01:01', '1 minute, 1 second' ),
     1555            array( '01:01:01', '1 hour, 1 minute, 1 second' ),
     1556            array( '0:05', '5 seconds' ),
     1557            array( '1:02:00', '1 hour, 2 minutes, 0 seconds' ),
     1558        );
     1559    }
    15211560}
Note: See TracChangeset for help on using the changeset viewer.