<commit_before><?php

class HTMLPurifier_HTMLModule_HTML5_BdoTest extends BaseTestCase
{
    public function testBdo()
    {
        $this->config->set('Attr.DefaultTextDir', 'ltr');

        $this->assertPurification('<bdo dir="ltr">Foo</bdo>');
        $this->assertPurification('<bdo dir="auto">Foo</bdo>', '<bdo dir="ltr">Foo</bdo>');
        $this->assertPurification('<bdo><span>Foo</span></bdo>', '<bdo dir="ltr"><span>Foo</span></bdo>');
        $this->assertPurification('<bdo><span>Foo</span></bdo>', '<bdo dir="ltr"><span>Foo</span></bdo>');
        $this->assertPurification('<div><bdo>Foo</bdo></div>', '<div><bdo dir="ltr">Foo</bdo></div>');
        $this->assertPurification('<bdo><div>Foo</div></bdo>', '<bdo dir="ltr"></bdo><div>Foo</div>');
    }

    public function testBdi()
    {
        $this->assertPurification('<bdi dir="auto">Foo</bdi>');
        $this->assertPurification('<bdi><span>Foo</span></bdi>');
        $this->assertPurification('<span><bdi>Foo</bdi></span>');
        $this->assertPurification('<div><bdi>Foo</bdi></div>');
        $this->assertPurification('<bdi><div>Foo</div></bdi>', '<bdi></bdi><div>Foo</div>');
    }
}<commit_msg>Add tests for dir global attribute<commit_after><?php

class HTMLPurifier_HTMLModule_HTML5_BdoTest extends BaseTestCase
{
    public function testBdo()
    {
        $this->config->set('Attr.DefaultTextDir', 'ltr');

        $this->assertPurification('<bdo dir="ltr">Foo</bdo>');
        $this->assertPurification('<bdo dir="auto">Foo</bdo>', '<bdo dir="ltr">Foo</bdo>');
        $this->assertPurification('<bdo><span>Foo</span></bdo>', '<bdo dir="ltr"><span>Foo</span></bdo>');
        $this->assertPurification('<bdo><span>Foo</span></bdo>', '<bdo dir="ltr"><span>Foo</span></bdo>');
        $this->assertPurification('<div><bdo>Foo</bdo></div>', '<div><bdo dir="ltr">Foo</bdo></div>');
        $this->assertPurification('<bdo><div>Foo</div></bdo>', '<bdo dir="ltr"></bdo><div>Foo</div>');
    }

    public function testBdi()
    {
        $this->assertPurification('<bdi dir="auto">Foo</bdi>');
        $this->assertPurification('<bdi><span>Foo</span></bdi>');
        $this->assertPurification('<span><bdi>Foo</bdi></span>');
        $this->assertPurification('<div><bdi>Foo</bdi></div>');
        $this->assertPurification('<bdi><div>Foo</div></bdi>', '<bdi></bdi><div>Foo</div>');
    }

    public function testDirAttr()
    {
        $this->assertPurification('<div dir="auto">Foo</div>');
        $this->assertPurification('<span dir="ltr">Foo</span>');
        $this->assertPurification('<p dir="rtl">Foo</p>');
        $this->assertPurification('<p dir="foo">Foo</p>', '<p>Foo</p>');
    }
}
{'fraction_non_alphanumeric': 0.25924542398206946, 'fraction_numerical': 0.0007471049682480389, 'mean_word_length': 4.421052631578948, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 163, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4662047', 'n_tokens_mistral': 1003, 'n_tokens_neox': 943, 'n_words': 93}