Last active
July 17, 2018 15:05
-
-
Save DanielGallo/fb75f6c8c5f77b6172290c9ce21d990b to your computer and use it in GitHub Desktop.
Using and checking classes in Sencha Test on Components and Elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scenario URL: http://examples.sencha.com/extjs/6.5.3/examples/kitchensink/?classic#form-contact | |
describe('Check component and element classes', function() { | |
it('should check the class applied to a component configuration', function() { | |
// These examples reference an Ext JS component and check its configured classes | |
// Example 1 | |
ST.button('form-contact button[text="Contact Us"]') | |
.get('cls') | |
.and(function(future) { | |
expect(future.data.cls).toContain('contactBtn'); | |
}); | |
// Example 2 | |
ST.button('form-contact button[text="Contact Us"]') | |
.expect('cls').toContain('contactBtn'); | |
// Example 3 | |
ST.button('form-contact button[text="Contact Us"]') | |
.hasCls('contactBtn'); | |
}); | |
it('should check the CSS class applied to a rendered element within a component', function() { | |
// These examples check the CSS classes on the rendered HTML elements | |
// Example 1 | |
ST.element('form-contact button[text="Contact Us"] => span') | |
.hasCls('x-btn-wrap-default-large'); | |
// Example 2 | |
ST.element('form-contact button[text="Contact Us"] => span') | |
.expect('className').toContain('x-btn-wrap-default-large'); | |
}); | |
it('should use a CSS class in the element selector', function() { | |
// This example shows the use of a CSS class being used in a composite locator, | |
// to select a DOM element within a button that has the cls "x-btn-wrap-default-large" | |
ST.element('form-contact button[text="Contact Us"] => .x-btn-wrap-default-large') | |
.visible(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment