From 26772172442b378c0f79b21064b9a559b1f71392 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 14 Dec 2011 15:49:48 -0800 Subject: [PATCH] Revised unit display to resemble lint output Reviewers: epriestley Test Plan: View a differential with unit results and compare display. Differential Revision: 1216 --- src/__celerity_resource_map__.php | 70 +++++++++---------- .../DifferentialUnitFieldSpecification.php | 42 ++++++----- .../differential/revision-detail.css | 28 ++++---- 3 files changed, 69 insertions(+), 71 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index d925a74b4d..0269cb8936 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -231,7 +231,7 @@ celerity_register_resource_map(array( ), 'differential-revision-detail-css' => array( - 'uri' => '/res/caa89172/rsrc/css/application/differential/revision-detail.css', + 'uri' => '/res/33592453/rsrc/css/application/differential/revision-detail.css', 'type' => 'css', 'requires' => array( @@ -487,7 +487,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-differential-feedback-preview' => array( - 'uri' => '/res/cb399257/rsrc/js/application/differential/behavior-comment-preview.js', + 'uri' => '/res/89633315/rsrc/js/application/differential/behavior-comment-preview.js', 'type' => 'js', 'requires' => array( @@ -653,7 +653,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-maniphest-transaction-preview' => array( - 'uri' => '/res/34e22038/rsrc/js/application/maniphest/behavior-transaction-preview.js', + 'uri' => '/res/44e86555/rsrc/js/application/maniphest/behavior-transaction-preview.js', 'type' => 'js', 'requires' => array( @@ -1678,7 +1678,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/2d40bd98/workflow.pkg.js', 'type' => 'js', ), - '47284eef' => + '3a0c5378' => array( 'name' => 'differential.pkg.js', 'symbols' => @@ -1689,26 +1689,9 @@ celerity_register_resource_map(array( 3 => 'javelin-behavior-differential-show-more', 4 => 'javelin-behavior-differential-diff-radios', ), - 'uri' => '/res/pkg/47284eef/differential.pkg.js', + 'uri' => '/res/pkg/3a0c5378/differential.pkg.js', 'type' => 'js', ), - '6ed92e8c' => - array( - 'name' => 'differential.pkg.css', - 'symbols' => - array( - 0 => 'differential-core-view-css', - 1 => 'differential-changeset-view-css', - 2 => 'differential-revision-detail-css', - 3 => 'differential-revision-history-css', - 4 => 'differential-table-of-contents-css', - 5 => 'differential-revision-comment-css', - 6 => 'differential-revision-add-comment-css', - 7 => 'differential-revision-comment-list-css', - ), - 'uri' => '/res/pkg/6ed92e8c/differential.pkg.css', - 'type' => 'css', - ), 'aa531d70' => array( 'name' => 'core.pkg.css', @@ -1733,6 +1716,23 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/aa531d70/core.pkg.css', 'type' => 'css', ), + 'ba5d2cd9' => + array( + 'name' => 'differential.pkg.css', + 'symbols' => + array( + 0 => 'differential-core-view-css', + 1 => 'differential-changeset-view-css', + 2 => 'differential-revision-detail-css', + 3 => 'differential-revision-history-css', + 4 => 'differential-table-of-contents-css', + 5 => 'differential-revision-comment-css', + 6 => 'differential-revision-add-comment-css', + 7 => 'differential-revision-comment-list-css', + ), + 'uri' => '/res/pkg/ba5d2cd9/differential.pkg.css', + 'type' => 'css', + ), 'bbe7e6f7' => array( 'name' => 'typeahead.pkg.js', @@ -1761,23 +1761,23 @@ celerity_register_resource_map(array( 'aphront-table-view-css' => 'aa531d70', 'aphront-tokenizer-control-css' => 'aa531d70', 'aphront-typeahead-control-css' => 'aa531d70', - 'differential-changeset-view-css' => '6ed92e8c', - 'differential-core-view-css' => '6ed92e8c', - 'differential-revision-add-comment-css' => '6ed92e8c', - 'differential-revision-comment-css' => '6ed92e8c', - 'differential-revision-comment-list-css' => '6ed92e8c', - 'differential-revision-detail-css' => '6ed92e8c', - 'differential-revision-history-css' => '6ed92e8c', - 'differential-table-of-contents-css' => '6ed92e8c', + 'differential-changeset-view-css' => 'ba5d2cd9', + 'differential-core-view-css' => 'ba5d2cd9', + 'differential-revision-add-comment-css' => 'ba5d2cd9', + 'differential-revision-comment-css' => 'ba5d2cd9', + 'differential-revision-comment-list-css' => 'ba5d2cd9', + 'differential-revision-detail-css' => 'ba5d2cd9', + 'differential-revision-history-css' => 'ba5d2cd9', + 'differential-table-of-contents-css' => 'ba5d2cd9', 'diffusion-commit-view-css' => '03ef179e', 'javelin-behavior' => '22c00e0e', 'javelin-behavior-aphront-basic-tokenizer' => 'bbe7e6f7', 'javelin-behavior-aphront-form-disable-on-submit' => '2d40bd98', - 'javelin-behavior-differential-diff-radios' => '47284eef', - 'javelin-behavior-differential-edit-inline-comments' => '47284eef', - 'javelin-behavior-differential-feedback-preview' => '47284eef', - 'javelin-behavior-differential-populate' => '47284eef', - 'javelin-behavior-differential-show-more' => '47284eef', + 'javelin-behavior-differential-diff-radios' => '3a0c5378', + 'javelin-behavior-differential-edit-inline-comments' => '3a0c5378', + 'javelin-behavior-differential-feedback-preview' => '3a0c5378', + 'javelin-behavior-differential-populate' => '3a0c5378', + 'javelin-behavior-differential-show-more' => '3a0c5378', 'javelin-behavior-phabricator-keyboard-shortcuts' => '2d40bd98', 'javelin-behavior-workflow' => '2d40bd98', 'javelin-dom' => '22c00e0e', diff --git a/src/applications/differential/field/specification/unit/DifferentialUnitFieldSpecification.php b/src/applications/differential/field/specification/unit/DifferentialUnitFieldSpecification.php index ce243ef0e2..c315363a83 100644 --- a/src/applications/differential/field/specification/unit/DifferentialUnitFieldSpecification.php +++ b/src/applications/differential/field/specification/unit/DifferentialUnitFieldSpecification.php @@ -44,37 +44,35 @@ final class DifferentialUnitFieldSpecification if ($udata) { $unit_messages = array(); foreach ($udata as $test) { - $name = phutil_escape_html(idx($test, 'name')); - $result = phutil_escape_html(idx($test, 'result')); + $name = idx($test, 'name'); + $result = idx($test, 'result'); if ($result != DifferentialUnitTestResult::RESULT_POSTPONED && $result != DifferentialUnitTestResult::RESULT_PASS) { - $userdata = phutil_escape_html(idx($test, 'userdata')); - if (strlen($userdata) > 256) { - $userdata = substr($userdata, 0, 256).'...'; - } + $userdata = phutil_utf8_shorten(idx($test, 'userdata'), 256); + $userdata = phutil_escape_html($userdata); $userdata = str_replace("\n", '
', $userdata); - $unit_messages[] = - ''. - ''.$name.''. - ''. - '
'. - strtoupper($result). - '
'. - ''. - ''.$userdata.''. - ''; - $utail = - '
'. - ''. - implode("\n", $unit_messages). - '
'. - '
'; + $unit_messages[] = + '
  • '. + ''. + phutil_escape_html(ucwords($result)). + ''. + ' '. + phutil_escape_html($name). + '

    '.$userdata.'

    '. + '
  • '; + } else if ($result == DifferentialUnitTestResult::RESULT_POSTPONED) { $postponed_count++; } } + $utail = + '
    '. + ''. + '
    '; } if ($postponed_count > 0 && diff --git a/webroot/rsrc/css/application/differential/revision-detail.css b/webroot/rsrc/css/application/differential/revision-detail.css index bca6b69fb3..efc53d3bf6 100644 --- a/webroot/rsrc/css/application/differential/revision-detail.css +++ b/webroot/rsrc/css/application/differential/revision-detail.css @@ -61,29 +61,29 @@ color: #666666; } -.differential-unit-table th { - white-space: nowrap; - padding: 4px 8px; +.differential-unit-block li { + margin-left: 1.5em; } -.differential-unit-table th.unit-test-result { +.differential-unit-block li p { + margin-left: 1em; + color: #666666; +} + +.differential-unit-block .unit-test-result { padding: 0; } -.differential-unit-table .result-fail { +.differential-unit-block .unit-result-fail { background: #ff3333; - padding: 4px 8px; + padding: 0 0.5em; + font-weight: bold; } -.differential-unit-table .result-unsound { +.differential-unit-block .unit-result-unsound { background: #cc33cc; - padding: 4px 8px; -} - -.differential-unit-table td { - width: 100%; - padding: 4px 8px; - color: #666666; + padding: 0 0.5em; + font-weight: bold; } .differential-keyboard-shortcuts {