def test_combine_selectors1(self): first = ''' foo foo1 bar baz baz1 pass dum dum1 div pass must must1 div pass qalandar qalandar1 div pass ''' second = [ (['foo', 'bar', 'baz'], True, True), (['foo1', 'bar', 'baz'], True, True), (['foo', 'bar', 'baz1'], True, True), (['foo1', 'bar', 'baz1'], True, True), ('pass', False, True), (['foo', 'bar', 'dum', 'div'], True, False), (['foo1', 'bar', 'dum', 'div'], True, True), (['foo', 'bar', 'dum1', 'div'], True, True), (['foo1', 'bar', 'dum1', 'div'], True, True), ('pass', False, True), (['foo', 'must', 'div'], True, False), (['foo1', 'must', 'div'], True, True), (['foo', 'must1', 'div'], True, True), (['foo1', 'must1', 'div'], True, True), ('pass', False, True), (['qalandar', 'div'], True, False), (['qalandar1', 'div'], True, True), ('pass', False, True), ] first = tokenize_selectors_and_properties(_in(first), self.indent) first = list(combine_selectors(_out(first, 2))) self.assertEquals(first, second)
def test_make_statements_list1(self): first = ''' .header .footer a .left .right pass .banner div pass :hover :active div pass @import print .header .footer div pass ''' second = [ ([['.header', 'a', '.left'], ['.footer', 'a', '.left'], ['.header', 'a', '.right'], ['.footer', 'a', '.right']], []), ([['.header', 'a', '.banner', 'div'], ['.footer', 'a', '.banner', 'div']], []), ([['.header', ':hover', 'div'], ['.footer', ':hover', 'div'], ['.header', ':active', 'div'], ['.footer', ':active', 'div']], []), ([['@import print', '.header', 'div'], ['@import print', '.footer', 'div']], []), ] first = tokenize_selectors_and_properties(_in(first), self.indent) first = combine_selectors(_out(first, 2)) first = list(make_statements_list(first)) self.assertEqual(first, second)
def test_combine_selectors(self): first = ''' .last _menu pass -item pass _selected color green _modified pass :hover :active color green font serif _last color green font serif width 100% ''' second = [ (['.last', '_menu'], True, True), ('pass', False, True), (['.last', '_menu', '-item'], True, False), ('pass', False, True), (['.last', '_menu', '-item', '_selected'], True, False), (('color', 'green'), False, True), (['.last', '_menu', '-item', '_selected', '_modified'], True, False), ('pass', False, True), (['.last', '_menu', '-item', '_selected', '_modified', ':hover'], True, False), (['.last', '_menu', '-item', '_selected', '_modified', ':active'], True, True), (('color', 'green'), False, True), (('font', 'serif'), False, False), (['.last', '_menu', '-item', '_last'], True, False), (('color', 'green'), False, True), (('font', 'serif'), False, False), (('width', '100%'), False, False), ] first = tokenize_selectors_and_properties(_in(first), self.indent) first = list(combine_selectors(_out(first, 2))) self.assertEquals(first, second)