diff --git a/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php b/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php
new file mode 100644
index 0000000000..76fa203b7e
--- /dev/null
+++ b/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php
@@ -0,0 +1,164 @@
+assertSame( $expected, wp_img_tag_add_decoding_attr( $image, $context ) );
+ }
+
+ /**
+ * Data provider.
+ *
+ * @return array
+ */
+ public function data_should_add_decoding_attr() {
+ return array(
+ 'default' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => 'no value',
+ 'expected' => '
',
+ ),
+ 'async' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => 'async',
+ 'expected' => '
',
+ ),
+ 'sync' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => 'sync',
+ 'expected' => '
',
+ ),
+ 'auto' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => 'auto',
+ 'expected' => '
',
+ ),
+ );
+ }
+
+ /**
+ * Tests that the `wp_img_tag_add_decoding_attr()` function should not add
+ * the 'decoding' attribute.
+ *
+ * @ticket 53232
+ *
+ * @dataProvider data_should_not_add_decoding_attr
+ *
+ * @param string $image The HTML `img` tag where the attribute should be added.
+ * @param string $context Additional context to pass to the filters.
+ * @param mixed $decoding The value for the 'decoding' attribute. 'no value' for default.
+ * @param string $expected The expected `img` tag.
+ */
+ public function test_should_not_add_decoding_attr( $image, $context, $decoding, $expected ) {
+ // Falsey values are allowed in the filter, cannot use `null` or `false` here.
+ if ( 'no value' !== $decoding ) {
+ add_filter(
+ 'wp_img_tag_add_decoding_attr',
+ static function( $value ) use ( $decoding ) {
+ return $decoding;
+ }
+ );
+ }
+
+ $this->assertSame( $expected, wp_img_tag_add_decoding_attr( $image, $context, $expected ) );
+ }
+
+ /**
+ * Data provider.
+ *
+ * @return array
+ */
+ public function data_should_not_add_decoding_attr() {
+ return array(
+ // Unhappy paths.
+ 'lazy (unaccepted value)' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => 'lazy',
+ 'expected' => '
',
+ ),
+ 'a non-string value' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => array( 'sync' ),
+ 'expected' => '
',
+ ),
+
+ // Falsey values.
+ 'false' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => false,
+ 'expected' => '
',
+ ),
+ 'null' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => null,
+ 'expected' => '
',
+ ),
+ 'empty string' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => '',
+ 'expected' => '
',
+ ),
+ 'empty array' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => array(),
+ 'expected' => '
',
+ ),
+ '0 int' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => 0,
+ 'expected' => '
',
+ ),
+ '0 string' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => '0',
+ 'expected' => '
',
+ ),
+ '0.0 float' => array(
+ 'image' => '
',
+ 'context' => '',
+ 'decoding' => 0.0,
+ 'expected' => '
',
+ ),
+ );
+ }
+}