mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Title test working
This commit is contained in:
@ -3,7 +3,7 @@ describe('TabBar view', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
element = $('<div class="tabs">' +
|
||||
'<a href="#" class="tab-item">Tab 1</a>' +
|
||||
'<a href="#" class="tab-item"><i class="icon-home"></i> Tab 1</a>' +
|
||||
'<a href="#" class="tab-item">Tab 2</a>' +
|
||||
'<a href="#" class="tab-item">Tab 3</a>');
|
||||
|
||||
@ -17,9 +17,15 @@ describe('TabBar view', function() {
|
||||
items = tabBar.getItems();
|
||||
|
||||
expect(items.length).toEqual(3);
|
||||
expect(items[0].el.innerText).toEqual('Tab 1');
|
||||
expect(items[1].el.innerText).toEqual('Tab 2');
|
||||
expect(items[2].el.innerText).toEqual('Tab 3');
|
||||
expect(items[0].getTitle()).toEqual('Tab 1');
|
||||
expect(items[1].getTitle()).toEqual('Tab 2');
|
||||
expect(items[2].getTitle()).toEqual('Tab 3');
|
||||
});
|
||||
|
||||
it('Should trim title', function() {
|
||||
expect(items[0].el.innerText.trim()).toEqual(items[0].getTitle());
|
||||
expect(items[1].el.innerText.trim()).toEqual(items[1].getTitle());
|
||||
expect(items[2].el.innerText.trim()).toEqual(items[2].getTitle());
|
||||
});
|
||||
|
||||
it('Should select', function() {
|
||||
@ -27,11 +33,11 @@ describe('TabBar view', function() {
|
||||
|
||||
// Track selection object
|
||||
tabBar.setSelectedItem(1);
|
||||
expect(tabBar.getSelectedItem().el.innerText).toEqual('Tab 2');
|
||||
expect(tabBar.getSelectedItem().getTitle()).toEqual('Tab 2');
|
||||
tabBar.setSelectedItem(0);
|
||||
expect(tabBar.getSelectedItem().el.innerText).toEqual('Tab 1');
|
||||
expect(tabBar.getSelectedItem().getTitle()).toEqual('Tab 1');
|
||||
tabBar.setSelectedItem(2);
|
||||
expect(tabBar.getSelectedItem().el.innerText).toEqual('Tab 3');
|
||||
expect(tabBar.getSelectedItem().getTitle()).toEqual('Tab 3');
|
||||
|
||||
// Track class change
|
||||
expect(tabBar.getSelectedItem().el.classList.contains('active')).toEqual(true);
|
||||
@ -46,4 +52,11 @@ describe('TabBar view', function() {
|
||||
expect(items[1].el.classList.contains('active')).toEqual(false);
|
||||
expect(items[2].el.classList.contains('active')).toEqual(false);
|
||||
});
|
||||
|
||||
it('Should set icon', function() {
|
||||
items = tabBar.getItems();
|
||||
|
||||
var item = items[0];
|
||||
expect(item.getIcon()).toBe(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user