Missed a whitelist, compensate for strict classes
This commit is contained in:
parent
7af1bf32d5
commit
229a10e142
|
@ -241,5 +241,5 @@ export function setup(helper) {
|
|||
);
|
||||
});
|
||||
|
||||
helper.whiteList(['img[class=emoji]']);
|
||||
helper.whiteList(['img[class=emoji]','img[class=emoji emoji-custom]']);
|
||||
}
|
||||
|
|
|
@ -113,21 +113,25 @@ describe PostAnalyzer do
|
|||
|
||||
it "doesn't count avatars as images" do
|
||||
post_analyzer = PostAnalyzer.new(raw_post_with_avatars, default_topic_id)
|
||||
PrettyText.stubs(:cook).returns(raw_post_with_avatars)
|
||||
expect(post_analyzer.image_count).to eq(0)
|
||||
end
|
||||
|
||||
it "doesn't count favicons as images" do
|
||||
post_analyzer = PostAnalyzer.new(raw_post_with_favicon, default_topic_id)
|
||||
PrettyText.stubs(:cook).returns(raw_post_with_favicon)
|
||||
expect(post_analyzer.image_count).to eq(0)
|
||||
end
|
||||
|
||||
it "doesn't count thumbnails as images" do
|
||||
post_analyzer = PostAnalyzer.new(raw_post_with_thumbnail, default_topic_id)
|
||||
PrettyText.stubs(:cook).returns(raw_post_with_thumbnail)
|
||||
expect(post_analyzer.image_count).to eq(0)
|
||||
end
|
||||
|
||||
it "doesn't count whitelisted images" do
|
||||
Post.stubs(:white_listed_image_classes).returns(["classy"])
|
||||
PrettyText.stubs(:cook).returns(raw_post_with_two_classy_images)
|
||||
post_analyzer = PostAnalyzer.new(raw_post_with_two_classy_images, default_topic_id)
|
||||
expect(post_analyzer.image_count).to eq(0)
|
||||
end
|
||||
|
|
|
@ -189,15 +189,19 @@ describe Post do
|
|||
end
|
||||
|
||||
it "doesn't count favicons as images" do
|
||||
PrettyText.stubs(:cook).returns(post_with_favicon.raw)
|
||||
expect(post_with_favicon.image_count).to eq(0)
|
||||
end
|
||||
|
||||
it "doesn't count thumbnails as images" do
|
||||
PrettyText.stubs(:cook).returns(post_with_thumbnail.raw)
|
||||
expect(post_with_thumbnail.image_count).to eq(0)
|
||||
end
|
||||
|
||||
it "doesn't count whitelisted images" do
|
||||
Post.stubs(:white_listed_image_classes).returns(["classy"])
|
||||
# I dislike this, but passing in a custom whitelist is hard
|
||||
PrettyText.stubs(:cook).returns(post_with_two_classy_images.raw)
|
||||
expect(post_with_two_classy_images.image_count).to eq(0)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue