Extend mock objects to satisfy code checker
This commit is contained in:
parent
272d6d269f
commit
35a44a6eb7
@ -26,6 +26,9 @@ class classList:
|
|||||||
def remove(self, *args, **kwargs):
|
def remove(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def toggle(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class document:
|
class document:
|
||||||
def querySelectorAll(
|
def querySelectorAll(
|
||||||
@ -34,10 +37,21 @@ class document:
|
|||||||
):
|
):
|
||||||
return [Node()]
|
return [Node()]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def getElementsByClassName(names):
|
||||||
|
"""
|
||||||
|
Returns an array-like object of all child elements which have all the given class name(s).
|
||||||
|
|
||||||
|
@param names: A string representing the class name(s) to match; multiple class names are separated by whitespace.
|
||||||
|
@type names: List(str)
|
||||||
|
@return: List(Node)
|
||||||
|
"""
|
||||||
|
return [Node()]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getElementById(_id):
|
def getElementById(_id):
|
||||||
"""
|
"""
|
||||||
Returns a object representing the element whose id property matches
|
Returns an object representing the element whose id property matches
|
||||||
|
|
||||||
@type _id: str
|
@type _id: str
|
||||||
@rtype: Node
|
@rtype: Node
|
||||||
@ -69,6 +83,7 @@ class document:
|
|||||||
class Node:
|
class Node:
|
||||||
|
|
||||||
classList = classList()
|
classList = classList()
|
||||||
|
id = None
|
||||||
offsetWidth = 0
|
offsetWidth = 0
|
||||||
textContent = ""
|
textContent = ""
|
||||||
|
|
||||||
@ -92,6 +107,10 @@ class Node:
|
|||||||
def setAttribute(self, *args, **kwargs):
|
def setAttribute(self, *args, **kwargs):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@property
|
||||||
|
def parentNode(self):
|
||||||
|
return super().__new__(self)
|
||||||
|
|
||||||
|
|
||||||
# __pragma__ ('noskip')
|
# __pragma__ ('noskip')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user