From 3535a5f32794114f8dc8b060a217f6da020401e3 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Fri, 12 Apr 2019 20:45:35 +0100 Subject: [PATCH] JsonContent: Add missing prefix to selector Change-Id: I977f6c565b93949a310d1207411f893cf83af996 --- includes/content/JsonContent.php | 2 +- resources/src/mediawiki.content.json.less | 2 ++ .../phpunit/includes/content/JsonContentTest.php | 16 ++++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/includes/content/JsonContent.php b/includes/content/JsonContent.php index 2cd1fb3b50..a1f199de2f 100644 --- a/includes/content/JsonContent.php +++ b/includes/content/JsonContent.php @@ -220,7 +220,7 @@ class JsonContent extends TextContent { return Html::rawElement( 'td', [], $this->arrayTable( $val ) ); } - return Html::element( 'td', [ 'class' => 'value' ], $this->primitiveValue( $val ) ); + return Html::element( 'td', [ 'class' => 'mw-json-value' ], $this->primitiveValue( $val ) ); } /** diff --git a/resources/src/mediawiki.content.json.less b/resources/src/mediawiki.content.json.less index ca950d58ec..4fa9ee25bd 100644 --- a/resources/src/mediawiki.content.json.less +++ b/resources/src/mediawiki.content.json.less @@ -18,8 +18,10 @@ padding: 0.5em 1em; } +/* TODO: Remove this old class once the content caches have cleared */ /* stylelint-disable-next-line selector-class-pattern */ .mw-json .value, +.mw-json-value, .mw-json-single-value { background-color: #dcfae3; font-family: monospace, monospace; diff --git a/tests/phpunit/includes/content/JsonContentTest.php b/tests/phpunit/includes/content/JsonContentTest.php index 7cddbad26d..8546d967a6 100644 --- a/tests/phpunit/includes/content/JsonContentTest.php +++ b/tests/phpunit/includes/content/JsonContentTest.php @@ -113,27 +113,27 @@ class JsonContentTest extends MediaWikiLangTestCase { ], [ (object)[ 'foo' ], - '' . + '
0"foo"
' . '
0"foo"
' ], [ (object)[ 'foo', 'bar' ], - '' . - '
0"foo"
1"bar"
' + '' . + '
0"foo"
1"bar"
' ], [ (object)[ 'baz' => 'foo', 'bar' ], - '' . - '
baz"foo"
0"bar"
' + '' . + '
baz"foo"
0"bar"
' ], [ (object)[ 'baz' => 1000, 'bar' ], - '' . - '
baz1000
0"bar"
' + '' . + '
baz1000
0"bar"
' ], [ (object)[ '' ], - '
0"' . + '
0"' . '<script>alert("evil!")</script>"' . '
', ], -- 2.20.1