jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/332346 )

Change subject: testsuitegenerator: Allow testing LabelWidget's 'input'
......................................................................


testsuitegenerator: Allow testing LabelWidget's 'input'

Its type is InputWidget, and InputWidget was previously not testable
(it's an abstract class). Allow testing concrete subclasses instead.

Also a little hack in the test suite, so that the input will actually
be appended to the page, to allow OO.ui.infuse() to work.

Change-Id: Ib0df55ccd1272a97b066efe64389fa8af7d918b6
---
M bin/generate-JSPHP-for-karma.php
M bin/testsuitegenerator.rb
M tests/index.php
3 files changed, 16 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/bin/generate-JSPHP-for-karma.php b/bin/generate-JSPHP-for-karma.php
index fa8bffd..8f71595 100644
--- a/bin/generate-JSPHP-for-karma.php
+++ b/bin/generate-JSPHP-for-karma.php
@@ -34,7 +34,12 @@
                        array_walk_recursive( $config, 'unstub' );
                        $config['infusable'] = true;
                        $instance = new_OOUI( $test['class'], $config );
-                       $testSuiteOutput[$theme][$className][] = "$instance";
+                       $output = "$instance";
+                       // HACK: OO.ui.infuse() expects to find this element 
somewhere on the page
+                       if ( $instance instanceof OOUI\LabelWidget && isset( 
$config['input'] ) ) {
+                               $output .= $config['input'];
+                       }
+                       $testSuiteOutput[$theme][$className][] = $output;
                }
        }
 }
diff --git a/bin/testsuitegenerator.rb b/bin/testsuitegenerator.rb
index 818068e..e46a4a0 100644
--- a/bin/testsuitegenerator.rb
+++ b/bin/testsuitegenerator.rb
@@ -83,10 +83,13 @@
        end
 
        expand_types_to_values = lambda do |types|
-               # Widget is not "testable", test a few different subclasses 
instead
+               # For abstract classes (not "testable"), test a few different 
subclasses instead
                if types.delete 'Widget'
                        types.push 'ButtonWidget', 'TextInputWidget'
                end
+               if types.delete 'InputWidget'
+                       types.push 'CheckboxInputWidget', 'TextInputWidget'
+               end
 
                return types.map{|t|
                        as_array = true if t.sub! '[]', ''
diff --git a/tests/index.php b/tests/index.php
index d71f34e..8ef56cc 100644
--- a/tests/index.php
+++ b/tests/index.php
@@ -74,7 +74,12 @@
                                                array_walk_recursive( $config, 
'unstub' );
                                                $config['infusable'] = true;
                                                $instance = new_OOUI( 
$test['class'], $config );
-                                               echo "<div 
id='JSPHPTestSuite_$theme$className$index'>$instance</div>\n";
+                                               $output = "$instance";
+                                               // HACK: OO.ui.infuse() expects 
to find this element somewhere on the page
+                                               if ( $instance instanceof 
OOUI\LabelWidget && isset( $config['input'] ) ) {
+                                                       $output .= 
$config['input'];
+                                               }
+                                               echo "<div 
id='JSPHPTestSuite_$theme$className$index'>$output</div>\n";
                                        }
                                }
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/332346
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0df55ccd1272a97b066efe64389fa8af7d918b6
Gerrit-PatchSet: 3
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <matma....@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to