mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00
test(virtualScroll): fix virtual scroll unit test
This commit is contained in:
@ -535,7 +535,7 @@ describe('VirtualScroll', () => {
|
|||||||
|
|
||||||
function getView(width?:number, height?: number, top?: number, left?: number): any {
|
function getView(width?:number, height?: number, top?: number, left?: number): any {
|
||||||
return {
|
return {
|
||||||
setLocal: function(){},
|
context: {},
|
||||||
rootNodes: [{
|
rootNodes: [{
|
||||||
nodeType: 1,
|
nodeType: 1,
|
||||||
offsetWidth: width,
|
offsetWidth: width,
|
||||||
|
@ -278,23 +278,21 @@ export function parseTemplate(template: string): string[] {
|
|||||||
|
|
||||||
let words = template.split(' ').filter(w => w.length > 0);
|
let words = template.split(' ').filter(w => w.length > 0);
|
||||||
words.forEach((word, i) => {
|
words.forEach((word, i) => {
|
||||||
if (word.length) {
|
FORMAT_KEYS.forEach(format => {
|
||||||
FORMAT_KEYS.forEach(format => {
|
if (word === format.f) {
|
||||||
if (word === format.f) {
|
if (word === FORMAT_A || word === FORMAT_a) {
|
||||||
if (word === FORMAT_A || word === FORMAT_a) {
|
// this format is an am/pm format, so it's an "a" or "A"
|
||||||
// this format is an am/pm format, so it's an "a" or "A"
|
if ((formats.indexOf(FORMAT_h) < 0 && formats.indexOf(FORMAT_hh) < 0) ||
|
||||||
if ((formats.indexOf(FORMAT_h) < 0 && formats.indexOf(FORMAT_hh) < 0) ||
|
(words[i - 1] !== FORMAT_m && words[i - 1] !== FORMAT_mm)) {
|
||||||
(words[i - 1] !== FORMAT_m && words[i - 1] !== FORMAT_mm)) {
|
// template does not already have a 12-hour format
|
||||||
// template does not already have a 12-hour format
|
// or this am/pm format doesn't have a minute format immediately before it
|
||||||
// or this am/pm format doesn't have a minute format immediately before it
|
// so do not treat this word "a" or "A" as an am/pm format
|
||||||
// so do not treat this word "a" or "A" as an am/pm format
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
formats.push(word);
|
|
||||||
}
|
}
|
||||||
});
|
formats.push(word);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return formats;
|
return formats;
|
||||||
|
Reference in New Issue
Block a user