How to use h1 method in Slash

Best Python code snippet using slash

sst.py

Source:sst.py Github

copy

Full Screen

...136 '<p>First 1</p>', 137 '<p>Second 1</p><p>Second 2</p>', 138 '<MULTITAG_HOLE/>' 139 ) 140 def test_same_level_h1(self): 141 self.assertTreeDiff( 142 '<h1>First 1</h1>', 143 '<h1>Second 1</h1><p>Second 2</p>', 144 '<h1>TEXT_HOLE</h1><MULTITAG_HOLE/>'145 ) 146 def test_same_level_h2(self): 147 self.assertTreeDiff( 148 '<h2>First 1</h2>', 149 '<h2>Second 1</h2><p>Second 2</p>', 150 '<h2>TEXT_HOLE</h2><MULTITAG_HOLE/>'151 ) 152 def test_same_level_h3(self): 153 self.assertTreeDiff( 154 '<h3>First 1</h3>', 155 '<h3>Second 1</h3><p>Second 2</p>', 156 '<h3>TEXT_HOLE</h3><MULTITAG_HOLE/>'157 ) 158 def test_same_level_h4(self): 159 self.assertTreeDiff( 160 '<h4>First 1</h4>', 161 '<h4>Second 1</h4><p>Second 2</p>', 162 '<h4>TEXT_HOLE</h4><MULTITAG_HOLE/>'163 ) 164 def test_same_level_h5(self): 165 self.assertTreeDiff( 166 '<h5>First 1</h5>', 167 '<h5>Second 1</h5><p>Second 2</p>', 168 '<h5>TEXT_HOLE</h5><MULTITAG_HOLE/>'169 ) 170 def test_same_level_h6(self): 171 self.assertTreeDiff( 172 '<h6>First 1</h6>', 173 '<h6>Second 1</h6><p>Second 2</p>', 174 '<h6>TEXT_HOLE</h6><MULTITAG_HOLE/>'175 ) 176 def test_same_level_a(self): 177 self.assertTreeDiff( 178 '<a>First 1</a>', 179 '<a>Second 1</a><p>Second 2</p>', 180 '<a>TEXT_HOLE</a><MULTITAG_HOLE/>'181 ) 182 def test_same_level1(self):183 self.assertTreeDiff(184 '<h1>Man seen</h1><p>By John Smith</p><p>A man was seen today.</p>',185 '<h1>Bird seen</h1><p>By John Smith</p><p>A bird was seen yesterday.</p>',186 '<h1>TEXT_HOLE</h1><p>By John Smith</p><MULTITAG_HOLE/>'187 )188 def test_same_level2(self):189 self.assertTreeDiff(190 '<p>By John Smith</p><h1>Man seen</h1><p>A man was seen today.</p>',191 '<p>By John Smith</p><h1>Bird seen</h1><p>A bird was seen yesterday.</p>',192 '<p>By John Smith</p><h1>TEXT_HOLE</h1><MULTITAG_HOLE/>'193 )194 def test_same_level3(self):195 self.assertTreeDiff(196 '<p>By John Smith</p><h1>Man seen</h1><p>A man was seen today.</p><p>The end.</p>',197 '<p>By John Smith</p><h1>Bird seen</h1><p>A bird was seen yesterday.</p><p>The end.</p>',198 '<p>By John Smith</p><h1>TEXT_HOLE</h1><MULTITAG_HOLE/><p>The end.</p>'199 )200 def test_confusing(self):201 # Note: The "~" are in here to make this more understandable by vertical alignment.202 self.assertTreeDiff(203 '<ul>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<li/>\n\t\t<li/>\n\t\t<li class="current"></li>\n\t\t<li/>\n\t</ul>'.replace('~', ''),204 '<ul><li class="current"></li>\n\t\t<li/>\n\t\t<li/>\n\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<li/>\n\t</ul>'.replace('~', ''),205 '<ul><MULTITAG_HOLE/>~~~~~~~~~~~~~~~<li/>\n\t\t<li/>\n\t\t<MULTITAG_HOLE/>~~~~~~~~~~~~~~~<li/>\n\t</ul>'.replace('~', ''),206 )207 def test_mixed1(self):208 self.assertTreeDiff(209 '<h1>Headline</h1><p>This thing</p><br/><div id="footer">Copyright 2006</div>',210 '<h1>Headline 2</h1><p id="first">This thing</p><br/><div id="footer">Copyright 2007</div>',211 '<h1>TEXT_HOLE</h1><p id="ATTRIB_HOLE">This thing</p><MULTITAG_HOLE/>'212 )213 def test_comments_ignored1(self):214 self.assertTreeDiff(215 '<h1><!-- comment --></h1>',216 '<h1></h1>',217 '<h1/>',218 )219 def test_comments_ignored2(self):220 self.assertTreeDiff(221 '<h1>A<!-- comment --></h1>',222 '<h1>A</h1>',223 '<h1>A</h1>',224 )225 def test_comments_ignored3(self):226 self.assertTreeDiff(227 '<h1><!-- comment -->A</h1>',228 '<h1>A</h1>',229 '<h1>A</h1>',230 )231 def test_comments_ignored4(self):232 self.assertTreeDiff(233 '<h1>A<!-- comment -->B</h1>',234 '<h1>AB</h1>',235 '<h1>AB</h1>',236 )237 def test_comments_ignored5(self):238 self.assertTreeDiff(239 '<h1>Title <!-- foo -->here</h1>',240 '<h1>Title here</h1>',241 '<h1>Title here</h1>',242 )243 def test_comments_ignored6(self):244 self.assertTreeDiff(245 '<h1>Title <!-- foo -->here</h1><!--<p>nothing</p>--><p><!--foo-->Paragraph here</p>',246 '<h1>Title here</h1><p>Paragraph here</p>',247 '<h1>Title here</h1><p>Paragraph here</p>',248 )249class TreeDiffTestCaseAlgorithm2(TreeDiffTestCaseAlgorithm1):250 """251 Like TreeDiffTestCaseAlgorithm1, but it uses algorithm 2. As such, it only252 needs to implement the methods whose outcome is different between the two253 algorithms.254 """255 algorithm = 2256 def test_texthole3(self):257 self.assertTreeDiff(258 '<h1>Headline</h1><p>Para</p><p>Final</p>',259 '<h1>Different</h1><p>Para</p><p>Diff</p>',260 '<h1>TEXT_HOLE</h1><p>Para</p><p>TEXT_HOLE</p>'261 )262 def test_multitaghole1(self):263 self.assertTreeDiff(264 '<div><p>Yes</p><p>No</p></div>',265 '<div><p>Yes</p><p>No</p><p>Maybe</p></div>',266 '<div><MULTITAG_HOLE/></div>'267 )268 def test_multitaghole2(self):269 self.assertTreeDiff(270 '<div>Text <p>Yes</p><p>No</p></div>',271 '<div>Text <p>Yes</p><p>No</p><p>Maybe</p></div>',272 '<div>Text <MULTITAG_HOLE/></div>'273 )274 def test_multitaghole3(self):275 self.assertTreeDiff(276 '<div><p>Yes</p><p>No</p> Tail</div>',277 '<div><p>Yes</p><p>No</p><p>Maybe</p> Tail</div>',278 '<div><MULTITAG_HOLE/></div>'279 )280 def test_multitaghole5(self):281 self.assertTreeDiff(282 '<div><p>Yes</p><p>No</p></div>',283 '<div><p>Yes</p><p>Bar</p><p>Maybe</p></div>',284 '<div><MULTITAG_HOLE/></div>'285 )286 def test_multitaghole6(self):287 self.assertTreeDiff(288 '<div><p>Yes</p><p>No</p></div>',289 '<div><p>Yes</p><p id="test">No</p><p>Maybe</p></div>',290 '<div><MULTITAG_HOLE/></div>'291 )292 def test_same_level_h1(self): 293 self.assertTreeDiff( 294 '<h1>First 1</h1>', 295 '<h1>Second 1</h1><p>Second 2</p>', 296 '<MULTITAG_HOLE/>'297 ) 298 def test_same_level_h2(self): 299 self.assertTreeDiff( 300 '<h2>First 1</h2>', 301 '<h2>Second 1</h2><p>Second 2</p>', 302 '<MULTITAG_HOLE/>'303 ) 304 def test_same_level_h3(self): 305 self.assertTreeDiff( 306 '<h3>First 1</h3>', ...

Full Screen

Full Screen

clean.py

Source:clean.py Github

copy

Full Screen

1# Copyright 2007,2008,2009,2011 Everyblock LLC, OpenPlans, and contributors2#3# This file is part of ebdata4#5# ebdata is free software: you can redistribute it and/or modify6# it under the terms of the GNU General Public License as published by7# the Free Software Foundation, either version 3 of the License, or8# (at your option) any later version.9#10# ebdata is distributed in the hope that it will be useful,11# but WITHOUT ANY WARRANTY; without even the implied warranty of12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13# GNU General Public License for more details.14#15# You should have received a copy of the GNU General Public License16# along with ebdata. If not, see <http://www.gnu.org/licenses/>.17#18from ebdata.templatemaker.clean import strip_template19from lxml import etree20from lxml.html import document_fromstring21import unittest22class StripTemplateTestCase(unittest.TestCase):23 def assertStrips(self, html1, html2, expected, num_removals, check_ids=False):24 """25 Asserts that strip_template(html1, html2) will result in the expected26 HTML string, and that the return value is num_removals.27 """28 # The test strings should *not* have <html> and <body> tags, for the29 # sake of brevity.30 tree1 = document_fromstring('<html><body>%s</body></html>' % html1)31 tree2 = document_fromstring('<html><body>%s</body></html>' % html2)32 expected = '<html><body>%s</body></html>' % expected33 got_removals = strip_template(tree1, tree2, check_ids=check_ids)34 got_tree = etree.tostring(tree1, method='html')35 self.assertEqual(got_tree, expected)36 self.assertEqual(got_removals, num_removals)37 def test_noop(self):38 self.assertStrips(39 '<p>Foo</p>',40 '<div>Bar</div>',41 '<p>Foo</p>',42 0,43 )44 def test_header(self):45 self.assertStrips(46 '<p>Header</p><h1>Headline 1</h1>',47 '<p>Header</p><h1>Headline 2</h1>',48 '<h1>Headline 1</h1>',49 1,50 )51 def test_footer(self):52 self.assertStrips(53 '<h1>Headline 1</h1><p>Footer</p>',54 '<h1>Headline 2</h1><p>Footer</p>',55 '<h1>Headline 1</h1>',56 1,57 )58 def test_header_and_footer(self):59 self.assertStrips(60 '<p>Header</p><h1>Headline 1</h1><p>Footer</p>',61 '<p>Header</p><h1>Headline 2</h1><p>Footer</p>',62 '<h1>Headline 1</h1>',63 2,64 )65 def test_header_same_tag(self):66 self.assertStrips(67 '<p>Header</p><p>Article 1</p>',68 '<p>Header</p><p>Article 2</p>',69 '<p>Article 1</p>',70 1,71 )72 def test_footer_same_tag(self):73 self.assertStrips(74 '<p>Article 1</p><p>Footer</p>',75 '<p>Article 2</p><p>Footer</p>',76 '<p>Article 1</p>',77 1,78 )79 def test_header_and_footer_same_tag(self):80 self.assertStrips(81 '<p>Header</p><p>Article 1</p><p>Footer</p>',82 '<p>Header</p><p>Article 2</p><p>Footer</p>',83 '<p>Article 1</p>',84 2,85 )86 def test_nested_1level(self):87 self.assertStrips(88 '<ul><li>News</li></ul><h1>Headline 1</h1>',89 '<ul><li>News</li></ul><h1>Headline 2</h1>',90 '<h1>Headline 1</h1>',91 2,92 )93 def test_nested_2level(self):94 self.assertStrips(95 '<div id="nav"><ul><li>News</li></ul></div><h1>Headline 1</h1>',96 '<div id="nav"><ul><li>News</li></ul></div><h1>Headline 2</h1>',97 '<h1>Headline 1</h1>',98 3,99 )100 def test_header_tail_same(self):101 self.assertStrips(102 '<p>Header</p> Tail <h1>Headline 1</h1>',103 '<p>Header</p> Tail <h1>Headline 2</h1>',104 '<h1>Headline 1</h1>',105 1,106 )107 def test_header_tail_different(self):108 self.assertStrips(109 '<p>Header</p> Tail1 <h1>Headline 1</h1>',110 '<p>Header</p> Tail2 <h1>Headline 2</h1>',111 ' Tail1 <h1>Headline 1</h1>',112 1,113 )114 def test_footer_head_same(self):115 self.assertStrips(116 '<h1>Headline 1</h1> Head <p>Footer</p>',117 '<h1>Headline 2</h1> Head <p>Footer</p>',118 '<h1>Headline 1</h1>',119 1,120 )121 def test_footer_head_different(self):122 self.assertStrips(123 '<h1>Headline 1</h1> Head1 <p>Footer</p>',124 '<h1>Headline 2</h1> Head2 <p>Footer</p>',125 '<h1>Headline 1</h1> Head1 ',126 1,127 )128 def test_same_tags_different_attributes1(self):129 self.assertStrips(130 '<p style="color: red;">Header</p><h1>Headline 1</h1>',131 '<p >Header</p><h1>Headline 2</h1>',132 '<p style="color: red;">Header</p><h1>Headline 1</h1>',133 0,134 )135 def test_same_tags_different_attributes2(self):136 self.assertStrips(137 '<p style="color: red;">Header</p><h1>Headline 1</h1>',138 '<p >Header</p><h1>Headline 1</h1>',139 '<p style="color: red;">Header</p>',140 1,141 )142 def test_different_level(self):143 """144 If data is identical but at a different level in the tree,145 strip_template() will not find it.146 """147 self.assertStrips(148 '<div><p>Foo</p><p>Bar</p></div>',149 '<p>Foo</p><p>Bar</p>',150 '<div><p>Foo</p><p>Bar</p></div>',151 0,152 )153 def test_ids_header(self):154 # This would be detected with check_ids=False, but this test makes sure155 # it doesn't break anything to use check_ids=True.156 self.assertStrips(157 '<p id="header">Header</p><h1>Headline 1</h1>',158 '<p id="header">Header</p><h1>Headline 2</h1>',159 '<h1>Headline 1</h1>',160 1,161 check_ids=True,162 )163 def test_ids_footer(self):164 self.assertStrips(165 '<h1>Headline 1</h1><p id="footer">Footer</p>',166 '<h1>Headline 2</h1><p id="footer">Footer</p>',167 '<h1>Headline 1</h1>',168 1,169 check_ids=True,170 )171 def test_ids_header_and_footer(self):172 self.assertStrips(173 '<p id="footer">Header</p><h1>Headline 1</h1><p id="footer">Footer</p>',174 '<p id="footer">Header</p><h1>Headline 2</h1><p id="footer">Footer</p>',175 '<h1>Headline 1</h1>',176 2,177 check_ids=True,178 )179 def test_ids_different_level1(self):180 self.assertStrips(181 '<div><p id="first">Foo</p><p id="second">Bar</p></div>',182 '<p id="first">Foo</p><p id="second">Bar</p>',183 '<div></div>',184 2,185 check_ids=True,186 )187 def test_ids_different_level2(self):188 self.assertStrips(189 '<div><p id="first">Foo</p><p id="second">Bar</p>Tail</div>',190 '<p id="first">Foo</p><p id="second">Bar</p>',191 '<div>Tail</div>',192 2,193 check_ids=True,194 )195 def test_ids_different_level3(self):196 self.assertStrips(197 '<div><p id="first">Foo</p><p id="second">Bar</p>Tail</div>',198 '<p id="first">Foo</p><p id="second">Bar</p>Tail',199 '<div></div>',200 2,201 check_ids=True,202 )203if __name__ == "__main__":...

Full Screen

Full Screen

test_heap.py

Source:test_heap.py Github

copy

Full Screen

1import py2from prolog.interpreter.heap import Heap3from prolog.interpreter.term import AttVar, BindingVar, Callable, Number, Atom, AttMap4def test_heap():5 h1 = Heap()6 v1 = h1.newvar()7 v2 = h1.newvar()8 h1.add_trail(v1)9 v1.binding = 110 h2 = h1.branch()11 h2.add_trail(v1)12 v1.binding = 213 h2.add_trail(v2)14 v2.binding = 315 h3 = h2.revert_upto(h1)16 assert v1.binding == 117 assert v2.binding is None18 assert h3 is h219 h1 = Heap()20 h2 = h1.revert_upto(h1)21 assert h2 is h122 h1 = Heap()23 h2 = h1.branch()24 h3 = h2.revert_upto(h1, discard_choicepoint=True)25 assert h3 is h126def test_heap_dont_trail_new():27 h1 = Heap()28 v1 = h1.newvar()29 h1.add_trail(v1)30 v1.binding = 131 h2 = h1.branch()32 v2 = h2.newvar()33 h2.add_trail(v1)34 v1.binding = 235 h2.add_trail(v2)36 v2.binding = 337 h3 = h2.revert_upto(h1)38 assert v1.binding == 139 assert v2.binding == 3 # wasn't undone, because v2 dies40 assert h3 is h241def test_heap_discard():42 h1 = Heap()43 h2 = h1.branch()44 h3 = h2.branch()45 h = h2.discard(h3)46 assert h3.prev is h147 assert h3 is h48 h0 = Heap()49 v0 = h0.newvar()50 h1 = h0.branch()51 v1 = h1.newvar()52 h2 = h1.branch()53 v2 = h2.newvar()54 h2.add_trail(v0)55 v0.binding = 156 h2.add_trail(v1)57 v1.binding = 258 h3 = h2.branch()59 h3.add_trail(v2)60 v2.binding = 361 h = h2.discard(h3)62 assert h3.prev is h163 assert h3 is h64 assert h3.revert_upto(h0)65 assert v0.binding is None66 assert v1.binding is None67 assert v2.binding == 3 # not backtracked, because it goes away68def test_heap_discard_variable_shunting():69 h0 = Heap()70 v0 = h0.newvar()71 h1 = h0.branch()72 v1a = h1.newvar()73 v1b = h1.newvar()74 h2 = h1.branch()75 v2 = h1.newvar()76 h2.add_trail(v0)77 v0.binding = 178 h2.add_trail(v1a)79 v1a.binding = 280 h = h1.discard(h2)81 assert h2.prev is h082 assert h2 is h83 assert h1.discarded84 assert h1.prev is h285 h2.add_trail(v1b)86 v1b.binding = 387 assert h2.revert_upto(h0)88 assert v0.binding is None89 assert v1a.binding == 2 # not backtracked, because it goes away90 assert v1b.binding == 3 # not backtracked, because it goes away91def test_new_attvar():92 h = Heap()93 v = h.new_attvar()94 assert isinstance(v, AttVar)95 assert v.created_after_choice_point is h96def test_add_trail_atts():97 hp = Heap()98 a = hp.new_attvar()99 assert a.created_after_choice_point is hp100 assert hp.trail_attrs is None101 ma = AttMap()102 ma.indexes = {"a": 0}103 a.value_list = [10]104 a.attmap = ma105 hp.add_trail_atts(a, "a")106 assert hp.trail_attrs is None107 hp2 = hp.branch()108 hp2.add_trail_atts(a, "a")109 assert hp2.trail_attrs == [(a, 0, 10)]110 a.add_attribute("a", 20)111 assert a.value_list == [20]112 hp2._revert()113 assert a.value_list == [10]114 hp3 = hp2.branch()115 hp3.add_trail_atts(a, "b")116 a.add_attribute("b", 30)117 assert a.value_list == [10, 30]118 assert a.attmap.indexes == {"a": 0, "b": 1}119 assert a.attmap is not ma120 hp3._revert()121 assert a.value_list == [10, None]122def test_heap_dont_trail_new_attvars():123 h1 = Heap()124 v1 = h1.new_attvar()125 h1.add_trail_atts(v1, "m")126 v1.add_attribute("m", 1)127 h2 = h1.branch()128 v2 = h2.new_attvar()129 h2.add_trail_atts(v1, "m")130 v1.add_attribute("m", 2)131 h2.add_trail_atts(v2, "m")132 v2.add_attribute("m", 3)133 h3 = h2.revert_upto(h1)134 t1 = v1.get_attribute("m")135 assert t1[0] == 1136 assert t1[1] == 0137 t2 = v2.get_attribute("m") # wasn't undone, because v2 dies138 assert t2[0] == 3139 assert t2[1] == 0140 assert h3 is h2141 142def test_discard_with_attvars():143 py.test.skip("not implemented yet")144 h0 = Heap()145 v0 = h0.new_attvar()146 h1 = h0.branch()147 v1 = h1.new_attvar()148 h2 = h1.branch()149 v2 = h2.new_attvar()150 h2.add_trail_atts(v0, "m")151 v0.atts = {"m": 1}152 h2.add_trail_atts(v1, "n")153 v1.atts = {"n": 2}154 h3 = h2.branch()155 h3.add_trail_atts(v2, "a")156 v2.atts = {"a": 3}157 h = h2.discard(h3)158 assert h3.prev is h1159 assert h3 is h160 assert h3.revert_upto(h0)161 assert v0.atts == {}162 assert v1.atts == {}163 assert v2.atts == {"a": 3}164def test_hookchain():165 hc = Heap()166 assert hc.hook is None167 hc.add_hook(1)168 hc.add_hook(2)169 hc.add_hook(3)170 assert hc.hook.attvar == 3171 assert hc.hook.next.attvar == 2172 assert hc.hook.next.next.attvar == 1173 assert hc.hook.next.next.next is None174def test_simple_hooks():175 hp = Heap()176 v = BindingVar()177 a = AttVar()178 v.unify(a, hp)179 assert hp.hook is None180 v.unify(Number(1), hp)181 assert hp.hook.attvar == a182 hp = Heap()183 v1 = BindingVar()184 v2 = BindingVar()185 a1 = AttVar()186 a2 = AttVar()187 v1.unify(a1, hp)188 assert hp.hook is None189 v2.unify(a2, hp)190 assert hp.hook is None191 v1.unify(v2, hp)192 assert hp.hook.attvar == a1193 hp = Heap()194 v1 = BindingVar()195 v2 = BindingVar()196 v3 = BindingVar()197 a1 = AttVar()198 a2 = AttVar()199 a3 = AttVar()200 v1.unify(a1, hp)201 v2.unify(a2, hp)202 v3.unify(a3, hp)203 v1.unify(v2, hp)204 v2.unify(v3, hp)205 assert hp.hook.attvar == a2206 assert hp.hook.next.attvar == a1207 assert hp.hook.next.next is None208 hp = Heap()209 v1 = BindingVar()210 v2 = BindingVar()211 a1 = AttVar()212 a2 = AttVar()213 v1.unify(a1, hp)214 v2.unify(a2, hp)215 assert hp.hook is None216 v1.unify(v2, hp)217 assert hp.hook.attvar == a1218 v1.unify(Number(1), hp)219 assert hp.hook.attvar == a2220 assert hp.hook.next.attvar == a1221 assert hp.hook.next.next is None222 hp = Heap()223 v1 = BindingVar()224 v2 = BindingVar()225 a1 = AttVar()226 a2 = AttVar()227 v1.unify(a1, hp)228 v2.unify(a2, hp)229 t1 = Callable.build("f", [v1, v2])230 t2 = Callable.build("f", [Atom("a"), Atom("b")])231 t1.unify(t2, hp)232 assert hp.hook.attvar == a2233 assert hp.hook.next.attvar == a1234 assert hp.hook.next.next is None235 hp = Heap()236 v = BindingVar()237 av = AttVar()238 v.unify(av, hp)239 assert hp.hook is None240 a = Callable.build("a")241 v.unify(a, hp)242 assert hp.hook.attvar == av243 v.unify(a, hp)244 assert hp.hook.attvar == av245 assert hp.hook.next is None246def test_hookchain_size():247 def size(heap):248 # for tests only249 if heap.hook is None:250 return 0251 current = heap.hook252 size = 0253 while current is not None:254 current = current.next255 size += 1256 return size257 h = Heap()258 assert size(h) == 0259 h.add_hook(1)260 assert size(h) == 1261 h.add_hook(2)262 assert size(h) == 2263 h.hook = None...

Full Screen

Full Screen

normalScrollElements.js

Source:normalScrollElements.js Github

copy

Full Screen

1QUnit.test('Testing normalScrollElements disabled', function(assert) {2 var id = '#fullpage-normalscrollelements';3 var FP = initFullpageNew(id, {autoScrolling:true});4 var windowHeight = $(window).height();5 trigger($('.normalscroll')[0], 'mouseenter');6 simulateMouseWheel('down');7 assert.deepEqual(getTransform(FP.test.translate3d), ['0', `${-(windowHeight*1)}`, '0'], `We expect sections transformation to be [0, ${-(windowHeight*1)}, 0]`);8});9QUnit.test('Testing normalScrollElements: ".normalScroll" - scrolling inside it', function(assert) {10 var id = '#fullpage-normalscrollelements';11 var FP = initFullpageNew(id, {autoScrolling:true, normalScrollElements: '.normalscroll'});12 trigger($('.normalscroll')[0], 'mouseenter');13 simulateMouseWheel('down');14 assert.deepEqual(getTransform(FP.test.translate3d), ['0', '0', '0'], `We expect sections transformation to be [0, 0, 0]`);15});16QUnit.test('Testing normalScrollElements: ".normalScroll" - scrolling outside it', function(assert) {17 var id = '#fullpage-normalscrollelements';18 var FP = initFullpageNew(id, {autoScrolling:true, normalScrollElements: '.normalscroll'});19 var windowHeight = $(window).height();20 trigger($(SECTION_ACTIVE_SEL).find('.title')[0], 'mouseenter');21 simulateMouseWheel('down');22 assert.deepEqual(getTransform(FP.test.translate3d), ['0', `${-(windowHeight*1)}`, '0'], `We expect sections transformation to be [0, ${-(windowHeight*1)}, 0]`);23});24QUnit.test('Testing normalScrollElements on dynamically added elements - scrolling inside it', function(assert) {25 var id = '#fullpage';26 var FP = initFullpageNew(id, {autoScrolling:true, normalScrollElements: '.normalscroll'});27 //adding the element dynamically28 var element = `29 <div class="normalscroll">30 <h1>Test</h1><h1>Test</h1><h1>Test</h1><h1>Test</h1>31 <h1>Test</h1><h1>Test</h1><h1>Test</h1><h1>Test</h1>32 <h1>Test</h1><h1>Test</h1><h1>Test</h1><h1>Test</h1>33 <h1>Test</h1><h1>Test</h1><h1>Test</h1><h1>Test</h1>34 </div>35 `;36 $(SECTION_ACTIVE_SEL).append(element);37 trigger($('.normalscroll')[0], 'mouseenter');38 simulateMouseWheel('down');39 assert.deepEqual(getTransform(FP.test.translate3d), ['0', '0', '0'], `We expect sections transformation to be [0, 0, 0]`);40});41QUnit.test('Testing normalScrollElements on dynamically added element - scrolling outside it', function(assert) {42 var id = '#fullpage';43 var FP = initFullpageNew(id, {autoScrolling:true, normalScrollElements: '.normalscroll'});44 var windowHeight = $(window).height();45 //adding the element dynamically46 var element = `47 <div class="normalscroll">48 <h1>Test</h1><h1>Test</h1><h1>Test</h1><h1>Test</h1>49 <h1>Test</h1><h1>Test</h1><h1>Test</h1><h1>Test</h1>50 <h1>Test</h1><h1>Test</h1><h1>Test</h1><h1>Test</h1>51 <h1>Test</h1><h1>Test</h1><h1>Test</h1><h1>Test</h1>52 </div>53 `;54 $(SECTION_ACTIVE_SEL).append(element);55 //entering with the mouse56 trigger($('.normalscroll')[0], 'mouseenter');57 //leaving with the mouse58 trigger($('.normalscroll')[0], 'mouseleave');59 simulateMouseWheel('down');60 assert.deepEqual(getTransform(FP.test.translate3d), ['0', `${-(windowHeight*1)}`, '0'], `We expect sections transformation to be [0, ${-(windowHeight*1)}, 0]`);...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful