Fix mobile overlay inert ownership (#1352)
This commit is contained in:
1 parent
c73fbf8379
commit
084c0b5732
2 files changed
+46
-1
No files matched your search
@@ -133,6 +133,37 @@ process.stdout.write(JSON.stringify({{current:controller.current(),hash:location
|
||||
}
|
||||
|
||||
|
||||
def test_late_inactive_route_event_does_not_release_background_owned_by_next_overlay():
|
||||
script = f"""
|
||||
const createInsights = require({json.dumps(str(CONTROLLER))});
|
||||
const listeners = {{}};
|
||||
const element = () => ({{
|
||||
hidden:false, inert:false, attributes:{{}}, focuses:0, listeners:{{}},
|
||||
setAttribute(name,value) {{ this.attributes[name] = String(value); }},
|
||||
removeAttribute(name) {{ delete this.attributes[name]; }},
|
||||
addEventListener(name,fn) {{ this.listeners[name] = fn; }},
|
||||
focus() {{ this.focuses += 1; }},
|
||||
}});
|
||||
const root=element(), launcher=element(), closeButton=element(), dock=element(), hud=element(), header=element();
|
||||
const location={{pathname:'/dashboard/', search:'', hash:'#/insights'}};
|
||||
const history={{state:null, pushState() {{}}, back() {{}}, replaceState(state,unused,url) {{
|
||||
this.state=state; location.hash=url.slice(url.indexOf('#'));
|
||||
}}}};
|
||||
const controller=createInsights({{
|
||||
root,launcher,closeButton,dock,hud,backgrounds:[header],history,location,
|
||||
eventTarget:{{addEventListener(name,fn) {{ listeners[name]=fn; }}}},
|
||||
mediaQuery:{{matches:true,addEventListener() {{}}}},
|
||||
}});
|
||||
controller.start();
|
||||
closeButton.listeners.click();
|
||||
header.inert = true;
|
||||
listeners.hashchange();
|
||||
process.stdout.write(JSON.stringify({{current:controller.current(), headerInert:header.inert}}));
|
||||
"""
|
||||
|
||||
assert run_node(script) == {"current": False, "headerInert": True}
|
||||
|
||||
|
||||
def test_escape_requests_back_navigation_only_while_insights_is_open():
|
||||
script = f"""
|
||||
const createInsights=require({json.dumps(str(CONTROLLER))});
|
||||
|
||||
Reference in new issue
Block a user