Index: modules/filter/filter.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.test,v
retrieving revision 1.79
diff -u -r1.79 filter.test
--- modules/filter/filter.test	22 Oct 2010 16:36:14 -0000	1.79
+++ modules/filter/filter.test	23 Oct 2010 00:47:28 -0000
@@ -494,12 +494,12 @@
     $this->assertFalse(user_access(filter_permission_name($this->disallowed_format), $this->web_user), t('A regular user does not have permission to use the disallowed text format.'));
 
     // Make sure that the allowed format appears on the node form and that
-    // the disallowed format does not.
+    // the disallowed format does not. And that the fallback format is there.
     $this->drupalLogin($this->web_user);
     $this->drupalGet('node/add/page');
-    $this->assertRaw($this->formatSelectorHTML($this->allowed_format), t('The allowed text format appears as an option when adding a new node.'));
-    $this->assertNoRaw($this->formatSelectorHTML($this->disallowed_format), t('The disallowed text format does not appear as an option when adding a new node.'));
-    $this->assertRaw($this->formatSelectorHTML(filter_format_load(filter_fallback_format())), t('The fallback format appears as an option when adding a new node.'));
+    $this->assertFormatSelector($this->allowed_format, TRUE, t('The allowed text format appears as an option when adding a new node.'));
+    $this->assertFormatSelector($this->disallowed_format, FALSE, t('The disallowed text format does not appear as an option when adding a new node.'));
+    $this->assertFormatSelector(filter_format_load(filter_fallback_format()), TRUE, t('The fallback format appears as an option when adding a new node.'));
   }
 
   function testFormatRoles() {
@@ -645,15 +645,29 @@
   }
 
   /**
-   * Returns the expected HTML for a particular text format selector.
+   * Asserts that the given format is or is not listed on the page.
    *
    * @param $format
-   *   An object representing the text format for which to return HTML.
-   * @return
-   *   The expected HTML for that text format's selector.
+   *   An object representing the text format to test.
+   * @param $inpage
+   *   TRUE to assert it is in the page, FALSE to asssrt it is not in the page.
+   * @param $message
+   *   The translated message to use in the assertion.
    */
-  function formatSelectorHTML($format) {
-    return '<option value="' . $format->format . '">' . $format->name . '</option>';
+  function assertFormatSelector($format, $inpage, $message) {
+    // This format selector could be the default/selected item, or it might
+    // not. So make sure to test for HTML that doesn't assume it's either
+    // selected or not selected.
+    $test1 = '<option value="' . $format->format . '"';
+    $test2 = $format->name . '</option>';
+    if ($inpage) {
+      $this->assertRaw($test1, $message);
+      $this->assertRaw($test2, $message);
+    }
+    else {
+      $this->assertNoRaw($test1, $message);
+      $this->assertNoRaw($test2, $message);
+    }
   }
 
   /**
