-1, "ids" => [] ], [ "ids" => [] ] ) ); // Note that we use the 'native' getElementById, not // DOMCompat::getElementById, in order to test T232390 $el = $doc->getElementById( 'mw-pagebundle' ); $this->assertNotEquals( null, $el ); $this->assertEquals( 'script', DOMCompat::nodeName( $el ) ); } /** * @covers ::storeInPageBundle */ public function testStoreInPageBundle() { $doc = ContentUtils::createDocument( "
Hello, world
" ); $p = DOMCompat::querySelector( $doc, 'p' ); DOMDataUtils::storeInPageBundle( $p, (object)[ 'parsoid' => [ 'go' => 'team' ], 'mw' => [ 'test' => 'me' ], ], DOMDataUtils::usedIdIndex( $p ) ); $id = DOMCompat::getAttribute( $p, 'id' ) ?? ''; $this->assertNotEquals( '', $id ); // Use the 'native' getElementById, not DOMCompat::getElementById, // in order to test T232390. $el = $doc->getElementById( $id ); $this->assertEquals( $p, $el ); } /** * @covers ::extractPageBundle */ public function testExtractPageBundle() { $html = <<<'EOF'Hello, world
EOF; $doc = DOMUtils::parseHTML( $html ); $pb = DOMDataUtils::extractPageBundle( $doc ); self::assertIsArray( $pb->parsoid['ids'] ); } }