def test_widget_base_element_attribute_dispatches_when_view_exists():
    view = FakeDispatchView({'name': 'attr', 'selector': '#id', 'attr': 'hello', 'value': 'world'})

    b_elem = BaseElement(id='id')
    b_elem.view = view
    b_elem._set_attribute('hello', 'world')
    view.verify()
def test_widget_base_element_property_parent_setter_sets_view():
    fake_parent = BaseElement(id='id')
    fake_parent.view = 3

    b_elem = BaseElement(id='id2')
    b_elem.parent = fake_parent
    assert b_elem.view == 3, "BaseElement.parent should set the value of BaseElement.view to the parent's view"
def test_widget_base_element_property_parent_setter_sets_view():
    fake_parent = BaseElement(id='id')
    fake_parent.view = 3

    b_elem = BaseElement(id='id2')
    b_elem.parent = fake_parent
    assert b_elem.view == 3, "BaseElement.parent should set the value of BaseElement.view to the parent's view"
def test_widget_base_element_attribute_dispatches_when_view_exists():
    view = FakeDispatchView({
        'name': 'attr',
        'selector': '#id',
        'attr': 'hello',
        'value': 'world'
    })

    b_elem = BaseElement(id='id')
    b_elem.view = view
    b_elem._set_attribute('hello', 'world')
    view.verify()
def test_widget_base_element_property_view_setter():
    b_elem = BaseElement(id='id')
    b_elem.view = 42
    assert b_elem._view == 42, 'BaseElement.view should set the value of internal BaseElement._view'
def test_widget_base_element_property_view_setter():
    b_elem = BaseElement(id='id')
    b_elem.view = 42
    assert b_elem._view == 42, 'BaseElement.view should set the value of internal BaseElement._view'