fix: bug
This commit is contained in:
parent
1080fb131c
commit
30fa29b0ac
|
|
@ -98,4 +98,26 @@ describe('HeroSlider Component', () => {
|
|||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
|
||||
describe('Slider Layout', () => {
|
||||
it('should have fixed width for slide container to enable horizontal scrolling', () => {
|
||||
const { StyleSheet } = require('react-native')
|
||||
const { HeroSlider } = require('./HeroSlider')
|
||||
|
||||
// 读取组件文件内容来验证样式定义
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const componentPath = path.join(__dirname, 'HeroSlider.tsx')
|
||||
const componentContent = fs.readFileSync(componentPath, 'utf-8')
|
||||
|
||||
// 验证 heroMainSlide 样式包含固定宽度265
|
||||
expect(componentContent).toContain('heroMainSlide: {')
|
||||
expect(componentContent).toContain('width: 265')
|
||||
|
||||
// 验证不包含 width: '100%'
|
||||
const heroMainSlideMatch = componentContent.match(/heroMainSlide:\s*{[^}]*}/s)
|
||||
expect(heroMainSlideMatch).toBeTruthy()
|
||||
expect(heroMainSlideMatch![0]).not.toContain("width: '100%'")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ const styles = StyleSheet.create({
|
|||
gap: 12,
|
||||
},
|
||||
heroMainSlide: {
|
||||
width: '100%',
|
||||
width: 265,
|
||||
},
|
||||
heroMainImage: {
|
||||
width: 265,
|
||||
|
|
|
|||
Loading…
Reference in New Issue